Jump to content

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.
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
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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.