Jump to content


Photo

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


  • Please log in to reply
2 replies to this topic

#1 Rianna

Rianna
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 23 May 2006 - 07:53 AM

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.

#2 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 23 May 2006 - 10:05 AM

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
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#3 Rianna

Rianna
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 24 May 2006 - 08:34 AM

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) View Post[/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]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users