Rianna Posted May 23, 2006 Share Posted May 23, 2006 Hi, how do I put code into my php form code. So that it will go to a thank you page once the post is made and error web page if the form is empty?It is standard php code using the _post command to send my form message. The form uses method="post" .It is only needed for the comments area, and the comments area code looks like this. $comments=$_POST['comments'];checkOK($comments);Hope you can help. Jen. Quote Link to comment https://forums.phpfreaks.com/topic/10244-how-to-put-a-thank-you-and-error-web-page-into-my-my-very-easy-php-form-code/ Share on other sites More sharing options...
samshel Posted May 23, 2006 Share Posted May 23, 2006 Hello,You can use header()$comments=$_POST['comments'];if(checkOK($comments)) {//comments ok, redirect to thank you page header("Location:thankyou.php");} else {//comments not ok, redirect to error page header("Location:error.php");}hth Quote Link to comment https://forums.phpfreaks.com/topic/10244-how-to-put-a-thank-you-and-error-web-page-into-my-my-very-easy-php-form-code/#findComment-38183 Share on other sites More sharing options...
Rianna Posted May 24, 2006 Author Share Posted May 24, 2006 OK, I finally found that one too. Thanks. Now everything else is working fine but I need one more thing, I hope you'll know it. How to put an auto message in my email along with the message that my form sends to my email? I have this but it isn't working. The input part of my form is called "message" Thanks! Jen$message = 'This message was sent via the form on my web site:' . "\n"; [!--quoteo(post=376272:date=May 23 2006, 05:05 AM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ May 23 2006, 05:05 AM) [snapback]376272[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hello,You can use header()$comments=$_POST['comments'];if(checkOK($comments)) {//comments ok, redirect to thank you page header("Location:thankyou.php");} else {//comments not ok, redirect to error page header("Location:error.php");}hth[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/10244-how-to-put-a-thank-you-and-error-web-page-into-my-my-very-easy-php-form-code/#findComment-38505 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.