# PHP problem

**URL:** <https://forum.kirupa.com/t/php-problem/196942>\
**Category:** Uncategorized\
**Created:** [August 12, 2006, 12:05am UTC](https://forum.kirupa.com/t/php-problem/196942 "2006-08-12T00:05:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saint\_cleve](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@saint\_cleve](https://forum.kirupa.com/u/saint_cleve)\
**Post date:** [August 12, 2006, 12:05am UTC](https://forum.kirupa.com/t/php-problem/196942/1 "2006-08-12T00:05:18Z")

</div>

i went thru the tutorial for the PHP form mailer

and it said if i change the “0” to a “1”

then my site will aoutomatically redirect…and i just get error messages

heres my code i used  
frome this link  
[http://www.kirupa.com/web/form\_mailer.htm](http://www.kirupa.com/web/form_mailer.htm)

```auto
<?PHP 
$to = "myemail@gmail.com"; 
$subject = "Contact Us Online Form";
$headers = "From: Form Mailer";
$forward = 1;
$location = "index.html";

$date = date ("l, F jS, Y"); 
$time = date ("h:i A"); 

$msg = "Message 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 your comments. We will get back with you as soon as possible"; 
} 

?>

```
