Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Send to thankyou page after form submit

    I have this at the bottom of the page and there i would like to redirect to thankyou page tried using header('thankyou.html....

    <?php
    } else {
    error_reporting(0);

    if (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))

    //Message sent!
    //It the message that will be displayed when the user click the sumbit button
    //You can modify the text if you want
    echo nl2br("
    <div class=\"MsgSent\">
    <h1>Congratulations!!</h1>
    <p>Thank you <b><?=$name;?></b>, your message is sent!<br /> I will get back to you as soon as possible.</p>
    </div>
    ");

    else

    // Display error message if the message failed to send
    echo "
    <div class=\"MsgError\">
    <h1>Error!!</h1>
    <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p>
    </div>";
    }
    ?>

  • #2
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    614
    Thanks
    48
    Thanked 64 Times in 64 Posts
    So... what exactly is the problem? Also, it would make things a lot easier to read if you could surround your php in php tags.
    "Yeah science!"
    Online Science Tools

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by pdpascual View Post
    I have this at the bottom of the page and there i would like to redirect to thankyou page tried using header('thankyou.html....
    That won't work. You can't output a header after starting your output. You can only use the header() function BEFORE any output to the browser.

    I have a link in my signature about this (headers already sent), please read it.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •