php contact form redirect need it to redirect to new page

i need this contact form to redirect in a new page created in wordpress at the moment it stays on same url i know i have to add header and the page url somewhere but just need some help to place it.

<?php 

$result = purple_handle_payback();
get_header(); 
the_post();
?>

<hgroup class="header-area discover-header group">
    <h1><?php the_title(); ?></h1>
</hgroup>

<div class="upload-page">
    <div class="upload-area group">
        <div class="upload-form group">
            <?php the_content(); ?>

            <?php if ( empty( $result ) || ( $error = ( $result instanceof Error ) ) ): ?>

                <p class="error"><?php if ( $error ) echo $result->getMessage(); ?></p>

                <form class="group" method="POST" action="<?php the_permalink(); ?>">
                    <h5>Your details</h5>

                    <div>
                        <?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_FIRST_NAME] ) ): ?>
                            <?php $value = $_SESSION['payback'][Payback::FIELD_FIRST_NAME]; ?>
                        <?php elseif ( !empty( $_POST[Payback::FIELD_FIRST_NAME] ) ): ?>
                            <?php $value = $_POST[Payback::FIELD_FIRST_NAME]; ?>
                        <?php else: ?>
                            <?php $value = ''; ?>
                        <?php endif; ?>

                        <input type="text" name="<?php echo Payback::FIELD_FIRST_NAME; ?>" placeholder="First name..." value="<?php echo $value; ?>" autocomplete="off">
                    </div>

                    <div>
                        <?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_LAST_NAME] ) ): ?>
                            <?php $value = $_SESSION['payback'][Payback::FIELD_LAST_NAME]; ?>
                        <?php elseif ( !empty( $_POST[Payback::FIELD_LAST_NAME] ) ): ?>
                            <?php $value = $_POST[Payback::FIELD_LAST_NAME]; ?>
                        <?php else: ?>
                            <?php $value = ''; ?>
                        <?php endif; ?>

                        <input type="text" name="<?php echo Payback::FIELD_LAST_NAME; ?>" placeholder="Last name..." value="<?php echo $value; ?>" autocomplete="off">
                    </div>

                    <div>
                        <?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_EMAIL] ) ): ?>
                            <?php $value = $_SESSION['payback'][Payback::FIELD_EMAIL]; ?>
                        <?php elseif ( !empty( $_POST[Payback::FIELD_EMAIL] ) ): ?>
                            <?php $value = $_POST[Payback::FIELD_EMAIL]; ?>
                        <?php else: ?>
                            <?php $value = ''; ?>
                        <?php endif; ?>

                        <input type="email" name="<?php echo Payback::FIELD_EMAIL; ?>" placeholder="Email address..." value="<?php echo $value; ?>" autocomplete="off">
                    </div>

                    <div>
                        <?php if ( empty( $_POST ) && !empty( $_SESSION['payback'][Payback::FIELD_TEL] ) ): ?>
                            <?php $value = $_SESSION['payback'][Payback::FIELD_TEL]; ?>
                        <?php elseif ( !empty( $_POST[Payback::FIELD_TEL] ) ): ?>
                            <?php $value = $_POST[Payback::FIELD_TEL]; ?>
                        <?php else: ?>
                            <?php $value = ''; ?>
                        <?php endif; ?>

                        <input type="tel" name="<?php echo Payback::FIELD_TEL; ?>" placeholder="Contact number..." value="<?php echo $value; ?>" autocomplete="off">
                    </div>

                    <br>            

                    <h5>Their details</h5>

                    <div>
                        <input type="text" name="<?php echo Payback::FIELD_FRIEND_FIRST_NAME; ?>" placeholder="First name..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_FIRST_NAME] ) ) echo $_POST[Payback::FIELD_FRIEND_FIRST_NAME]; ?>" autocomplete="off">
                    </div>

                    <div>
                        <input type="text" name="<?php echo Payback::FIELD_FRIEND_LAST_NAME; ?>" placeholder="Last name..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_LAST_NAME] ) ) echo $_POST[Payback::FIELD_FRIEND_LAST_NAME]; ?>" autocomplete="off">
                    </div>

                    <div>
                        <input type="email" name="<?php echo Payback::FIELD_FRIEND_EMAIL; ?>" placeholder="Email address..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_EMAIL] ) ) echo $_POST[Payback::FIELD_FRIEND_EMAIL]; ?>" autocomplete="off">
                    </div>

                    <div>
                        <input type="tel" name="<?php echo Payback::FIELD_FRIEND_TEL; ?>" placeholder="Contact number..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_TEL] ) ) echo $_POST[Payback::FIELD_FRIEND_TEL]; ?>" autocomplete="off">
                    </div>

                    <div>
                        <input type="text" name="<?php echo Payback::FIELD_FRIEND_ROLE; ?>" placeholder="Current role..." value="<?php if ( !empty( $_POST[Payback::FIELD_FRIEND_ROLE] ) ) echo $_POST[Payback::FIELD_FRIEND_ROLE]; ?>" autocomplete="off">
                    </div>

                    <input type="submit" value="Finish" name="<?php echo Payback::FIELD_SUBMIT; ?>" width="27" height="23">  
                </form> 

                       <?php else: ?>
                <p>Thank you. We'll get back to you shortly.</p>
            <?php endif; ?>

        </div>

        <?php get_sidebar( 'payback' ); ?>
    </div>
</div>

<?php get_footer(); ?>

i have added the whole of the code for the contact form so i hope it helps

Read More

thanks guys

any help would be much apreeciated

Related posts

Leave a Reply

1 comment

  1. Most probably, the problem lies here:

    <form class="group" method="POST" action="<?php the_permalink(); ?>">
    

    When a form is submitted, the action attribute tells the browser where to submit the form.

    In your case, the_permalink() is a wordpress function which prints out the current page’s URL.