Web Hosting Talk







View Full Version : yet another form processor issue...


DLee
12-01-2004, 08:22 PM
I'm not new to coding and web design, but i'm fairly new to php. So here's the issue:


<?
$email=$_POST['email'];
$comments=$_POST['comments'];
$to="wildbill@bigsecret.com";
$message="You have a new comment from $email. The comment: \n$comments\n\n";
if(mail($to,"Comments From Your Site",$message,"From: $email\n"))
{
echo "Thanks for your comments.";
}
else
{
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>


I would much rather have the form go to either goodjob.html or youscrewedupsomewhere.html than having it echo simple text. I know the META refresh trick, but that isn't what I'm looking for.

I'm sure you guys can figure this one out, so I'll say thanks in advance,
DLee

cow_helmet
12-01-2004, 09:47 PM
You can just add this after you send your message:

header("Location: ./goodjob.html");

after your mail has been sent. Just make sure not to send anything to the browser before you set the header.

DLee
12-01-2004, 10:42 PM
thanks, that was just what i needed