theflyingminstr
03-13-2009, 12:50 AM
Hi all, I keep getting this error i someones got a minute to check out this contact form script
PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING on line 37
Line 37:
Address: '.$Address'
<?php
// get posted data into local variables
$EmailFrom = "contact@email.com";
$EmailTo = "contact@email.com";
$Subject = "Inquiry from website.com";
$Name = $_POST['Name'];
$Address = $_POST['Address'];
$City = $_POST['City'];
$State = $_POST['State'];
$Zip = $_POST['Zip'];
$Phone = $_POST['Phone'];
$email = $_POST['email'];
$contactBy = $_POST['contactBy'];
$bestTimeToCall = $_POST['bestTimeToCall'];
$comments = $_POST['comments'];
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
$headers = "From: website.com <contact@email.com>\r\n";
$headers .= "Reply-To: ".$Name." <".$email.">\r\n";
$headers .= "Return-Path: ".$Name." <".$email.">\r\n";
// prepare email body text
$body= '
Name: '.$Name'
Address: '.$Address'
City: '.$City;'
State: '.$State'
Zip: '.Zip'
Phone: '.$Phone'
Email: '.$email'
Contact by: '.$ContactBy'
Best Time: '.$bestTimeToCall'
Comments: '.$comments'
';
// send email
$success = mail($EmailTo, $body, $headers);
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_success.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_error.html\">";
}
?>
Thank you
PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING on line 37
Line 37:
Address: '.$Address'
<?php
// get posted data into local variables
$EmailFrom = "contact@email.com";
$EmailTo = "contact@email.com";
$Subject = "Inquiry from website.com";
$Name = $_POST['Name'];
$Address = $_POST['Address'];
$City = $_POST['City'];
$State = $_POST['State'];
$Zip = $_POST['Zip'];
$Phone = $_POST['Phone'];
$email = $_POST['email'];
$contactBy = $_POST['contactBy'];
$bestTimeToCall = $_POST['bestTimeToCall'];
$comments = $_POST['comments'];
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
$headers = "From: website.com <contact@email.com>\r\n";
$headers .= "Reply-To: ".$Name." <".$email.">\r\n";
$headers .= "Return-Path: ".$Name." <".$email.">\r\n";
// prepare email body text
$body= '
Name: '.$Name'
Address: '.$Address'
City: '.$City;'
State: '.$State'
Zip: '.Zip'
Phone: '.$Phone'
Email: '.$email'
Contact by: '.$ContactBy'
Best Time: '.$bestTimeToCall'
Comments: '.$comments'
';
// send email
$success = mail($EmailTo, $body, $headers);
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_success.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_error.html\">";
}
?>
Thank you