Jump to content

Archived

This topic is now archived and is closed to further replies.

Rianna

How to put a thank you and error web page into my my very easy php form code?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.