I’ve been working with the php mail form tutorial, and everything is working great except for one thing. If I chose to not redirect, it works, but if I want to redirect the browser to another page, it gives me an error. This is the code
<?PHP
$to = “adress@wherever.com”;
$subject = “Test Form Regus”;
$headers = “From: Performance Bridge”;
$forward = 0; <- when I change this to 1, it gives me an error
$location = “http://www.wherever.com”;
$date = date (“l, F jS, Y”);
$time = date (“h:i A”);
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.
“;
if ($_SERVER[‘REQUEST_METHOD’] == “POST”) {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) .” : ". $value . "
“;
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) .” : ". $value . "
";
}
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header (“Location:$location”);
}
else {
echo “Thank you for submitting our form. We will get back to you as soon as possible.”;
}
?>
Any ideas why
($forward == 1) {
header (“Location:$location”);
}
will not let me redirect? Thanks in advance!