Can't find the error, please help
Posted: Tue Jan 11, 2011 11:37 am
So I am writing a very simple code to validate a certain field on a form and send email if it's good or popup an alert if it's not but I keep getting... Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in send-mail.php on line 11 ... I have no freaking idea what that means, I have tried checking line 11 but as far as I can tell there is no problem with it. please help, Thank you.
Code: Select all
<?php
$cname = $_POST['companyName'];
$addy = $_POST['companyAddress'];
$cphone = $_POST['companyPhone'];
$name = $_POST['contactName'];
$phone = $_POST['contactPhone'];
$email = $_POST['contactEmail'];
$acct = $_POST['knocAccount'];
$to = 'myemailaddress';
$subject = 'New Account - ' . $name . 'From ' . $cname;
$message = "<html><head> <title>New Account</title> </head> <body> <p><b>Company Name:</b> "' . $cname . '"<br /> Company Address: "' . $addy . '"<br /> Company Phone: "' . $cphone . '"<br /><br /> <b>Contact Name:</b> "' . $name . '"<br /> Contact Phone: "' . $phone . '"<br /> Contact Email: "' . $email . '"<br /> Knox Account Number: "' . $acct '"<br /> </body> </html> ";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if(!preg_match('/^[0-9]', $addy)) {
echo "<script language='javascript'>alert('Please use a real address and try again')</script>";
header("location: http://www.knoxservices.com/order/create-account.asp");
}else{
mail($to, $subject, $message, $headers);
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><html><head><meta http-equiv='REFRESH' content='30;url=http://www.knoxservices.com/order/create-account.asp'><link href='../style.css' type='text/css' rel='stylesheet' /></head><body>";
echo "<h2>Your information has been received!</h2><br /><p>Our account reps are reviewing your information now and will be contacting you soon with your new account information. Thanks for creating an account with us!<br />You will be redirected in 30 seconds</p></body></html>";
}
?>