# PHP form Mailer

**URL:** <https://forum.kirupa.com/t/php-form-mailer/282593>\
**Category:** programming\
**Created:** [February 24, 2009, 1:04am UTC](https://forum.kirupa.com/t/php-form-mailer/282593 "2009-02-24T01:04:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![h2ofun](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@h2ofun](https://forum.kirupa.com/u/h2ofun)\
**Post date:** [February 24, 2009, 1:04am UTC](https://forum.kirupa.com/t/php-form-mailer/282593/1 "2009-02-24T01:04:43Z")

</div>

Okay, I have spent half the day trying to figure this out. I use the code from  
[http://www.kirupa.com/web/form\_mailer.htm](http://www.kirupa.com/web/form_mailer.htm)

I now have  
\<?PHP  
$to = "h2ofun@h2ofun.net";  
$subject = “VHSVideoConversions Request”;  
$headers = “From: VHSVideoConversion”;  
$forward = 1;  
$location = “[http://www.h2ofun.net](http://www.h2ofun.net)”;

$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.”;  
}

?\>

I have no spaces before or after the file. But, I always get this error when I turn on redirection.

**Warning** : Cannot modify header information - headers already sent by (output started at /home/h2ofun/www/www/Home/mailer.php:1) in **/home/h2ofun/www/www/Home/mailer.php** on line \*\*28

Any ideas?

Thanks

Dave  
\*\*
