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. 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 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] 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
Archived
This topic is now archived and is closed to further replies.