Hi guys. Can someone help Me? When im submitting a form, Im getting a "Parse error: syntax error, unexpected T_STRING on line 27" error Here's the code... the red part is line 27 on where im getting the error <?php $to = $_REQUEST['sendto'] ; $from = $_REQUEST['Email'] ; $name = $_REQUEST['Name'] ; $headers = "From: $from"; $subject = "Web Contact Data"; $fields = array(); $fields{"Name"} = "Name"; $fields{"Company"} = "Company"; $fields{"Email"} = "Email"; $fields{"Phone"} = "Phone"; $fields{"list"} = "Mailing List"; $fields{"Message"} = "Message"; $body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: paul_agabin@yahoo.com"; $subject2 = "Thank you for contacting us"; $autoreply = "Thank you for contacting us. [COLOR="Red"]if($from == '') {print "You have not entered an email, please go back and try again"; }[/COLOR] else { if($name == '') {print "You have not entered a name, please go back and try again"; } else { $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) {header( "Location: http://www.YourDomain.com/thankyou.html" );} else {print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; } } } ?> Code (markup):
$headers2 = "From: paul_agabin@yahoo.com"; $subject2 = "Thank you for contacting us"; $autoreply = "Thank you for contacting us. Code (markup): should be: $headers2 = "From: paul_agabin@yahoo.com"; $subject2 = "Thank you for contacting us"; $autoreply = "Thank you for contacting us."; Code (markup):
Spot on. Remember, when you get given a line number, it tells you it wasn't expecting what's there. You should check the lines before this to see why. The most common error like this, is because the line preciding it doesn't end in a semi-colon.