phpnewbieca Posted November 25, 2009 Share Posted November 25, 2009 I am receiving the following error: Parse error: syntax error, unexpected T_STRING in /home/xgasq39z/public_html/repair_upgrade.php on line 183 I have checked the code several times and I cannot find an error in the function below. function Repair_Upgrade_2() { // email customer global $Send_To, $Date, $confirmation_number, $Eighteen, $List, $List_2, $Dsn, $Title, $Fname, $Lname, $Address, $City, $City_2, $State, $Zip, $Email, $Phone, $Phone_2, $Computerbrand, $Computermodel, $Cd, $Cd_rw, $Cpu, $Dvd, $Dvd_rw, $Graphic_card, $Memory, $Modem, $Monitor, $Multimedia, $Network_card, $Printer, $Scanner, $Sound_card, $Speakers, $Comments; // EDIT THE LINE BELOW AS REQUIRED // $Send_To = "service@horace-franklin-jr.com"; // FUNCTION function died() { // your error code can go here echo "These errors appear below.\n"; echo "<br /><br />\n"; echo "$error_message\n"; echo "<br /><br />\n"; echo "Please go back and fix these errors.\n"; echo "<br /><br />\n"; die(); } $error_message = ""; $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$"; if(!eregi($email_exp,$Email)) { $error_message.= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "^[a-z .'-]+$"; if(!eregi($string_exp,$Fname)) { $error_message.= 'The First Name you entered does not appear to be valid.<br />'; } if(!eregi($string_exp,$Lname)) { $error_message.= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($Comments) < 2) { $error_message.= 'The Comments you entered do not appear to be valid.<br />'; } $string_exp = "^[0-9 .-]+$"; if(!eregi($string_exp,$Phone)) { $error_message.= 'The Daytime Phone Number you entered does not appear to be valid.<br />'; } if(!eregi($string_exp,$Phone_2)) { $error_message.= 'The Evening Phone Number you entered does not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } //FUNCTION function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $subject = "RE: Repair-Upgrade Order\n\n"; $email_message = "Hello, $Title $Fname $Lname\n"; $email_message.= "Thank you for your order.\n"; $email_message.= "This is what you submitted:\n"; $email_message.= "Age Verification: $Eighteen\n"; $email_message.= "Type Order: $List\n"; $email_message.= "Type Service: $List_2\n"; $email_message.= "Title: $Title\n"; $email_message.= "First Name: ".clean_string($Fname)."\n"; $email_message.= "Last Name: ".clean_string($Lname)."\n"; $email_message.= "Address: $Address\n"; $email_message.= "City: $City\n"; $email_message.= "$City_2\n"; $email_message.= "State: $State\n"; $email_message.= "Zip Code: $Zip\n"; $email_message.= "Email Address: ".clean_string($Email)."\n"; $email_message.= "Daytime Telephone: ".clean_string($Phone)."\n"; * 183 $email_message.= "Evening Telephone: ".clean_string($Phone_2)."\n"; $email_message.= "Computer Brand: $Computerbrand\n"; $email_message.= "Computer Model: $Computermodel\n"; $email_message.= "Items to be repaired, replaced, or upgraded.\n"; $email_message.= "CD: $Cd \t\t\t\t CD RW: $Cd_rw \t\t\t\t CPU: $Cpu\n"; $email_message.= "DVD: $Dvd \t\t\t\t DVD RW: $Dvd_rw \t\t\t\t Graphic Card: $Graphic_card\n"; $email_message.= "Memory: $Memory \t\t\t\t Modem: $Modem \t\t\t\t Monitor: $Monitor\n"; $email_message.= "Multimedia: $Multimedia \t\t\t\t "Network Card: $Network_card \t\t\t\t Printer: $Printer\n"; $email_message.= "Scanner: $Scanner \t\t\t\t Sound Card: $Sound_card \t\t\t\t Speakers: $Speakers\n"; $email_message.= "Comments: ".clean_string($Comments)."\n\n"; $email_message.= "Please VALIDATE your ORDER by clicking the link below.\n"; $email_message.= "You will need your CONFIRMATION NUMBER $confirmation_number to validate your ORDER.\n\n"; $email_message.= "<a href=\"www.horace-franklin-jr.com/valid_repair_upgradeform.html\"> Validate Order</a>\n"; // create email headers $headers = "From: ".$Send_To."\r\n". "Reply-To: ".$Send_To."\r\n". "X-Mailer: PHP/". phpversion(); $formsent = mail($Email, $subject, $email_message, $headers); if ($formsent) { echo $formsent; } else { echo "email was not sent"; die; } } Please tell me what is wrong with this function. Quote Link to comment https://forums.phpfreaks.com/topic/182861-unexpected-t_string-error/ Share on other sites More sharing options...
oni-kun Posted November 25, 2009 Share Posted November 25, 2009 It'd be helpful if you showed us where that line was, look at it. Either you're missing an endline or there is a string defined where the parameters do not allow. Quote Link to comment https://forums.phpfreaks.com/topic/182861-unexpected-t_string-error/#findComment-965172 Share on other sites More sharing options...
phpnewbieca Posted November 25, 2009 Author Share Posted November 25, 2009 you should see * 183 before 'email_message.=...' Quote Link to comment https://forums.phpfreaks.com/topic/182861-unexpected-t_string-error/#findComment-965181 Share on other sites More sharing options...
Virvo Posted November 25, 2009 Share Posted November 25, 2009 I cant really spot anything particular... but instead of using all those strings for $email_message - try using heredoc syntax - it should resolve the problem and make it much more neat. Quote Link to comment https://forums.phpfreaks.com/topic/182861-unexpected-t_string-error/#findComment-965184 Share on other sites More sharing options...
mikesta707 Posted November 25, 2009 Share Posted November 25, 2009 this line $email_message.= "Multimedia: $Multimedia \t\t\t\t "Network Card: $Network_card \t\t\t\t Printer: $Printer\n"; should be $email_message.= "Multimedia: $Multimedia \t\t\t\t Network Card: $Network_card \t\t\t\t Printer: $Printer\n"; Quote Link to comment https://forums.phpfreaks.com/topic/182861-unexpected-t_string-error/#findComment-965199 Share on other sites More sharing options...
phpnewbieca Posted November 25, 2009 Author Share Posted November 25, 2009 Thanks, I will try it. Quote Link to comment https://forums.phpfreaks.com/topic/182861-unexpected-t_string-error/#findComment-965542 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.