Page 1 of 1

PHP Mail

Posted: Wed Dec 01, 2010 11:28 pm
by brmcdani44
I am getting an unexpected T-String error on line 12 can anyone help? I have been coding for hours now and have the code blindness! lol Thanks I will sleep much better if I get this solved tonight!

Thanks in advance

Code: Select all

<?php
if ($why == 4){
echo"Click the back button and try the question again.";
exit();
}
else{
$region = $_REQUEST['region'];
$lakename = $_REQUEST['lakename'];
$why = $_REQUEST['why'];
$body = "Region: $region
\nLake Name: $lakename";
mail("brettm938@gmail.com", "Lake Add Request", $body);
}
?>
<meta http-equiv="refresh" content="0;url=thankyou.htm">

Re: PHP Mail

Posted: Thu Dec 02, 2010 1:11 am
by social_experiment
I got a mail() related error, something about a missing 'From' header no 'unexpected T-String error on line 12'

Re: PHP Mail

Posted: Thu Dec 02, 2010 6:29 am
by Bind
add the missing From: header ...

Code: Select all

<?php
if ($why == 4){
echo"Click the back button and try the question again.";
exit();
}
else{

$headers = "From: email@domain.com\r\nReply-To: email@domain.com";

$region = $_REQUEST['region'];
$lakename = $_REQUEST['lakename'];
$why = $_REQUEST['why'];
$body = "Region: $region
\nLake Name: $lakename";
mail("brettm938@gmail.com", "Lake Add Request", $body,$headers);
}
?>
<meta http-equiv="refresh" content="0;url=thankyou.htm">