mschneikert Posted November 21, 2008 Share Posted November 21, 2008 Hi there, It's my second day learning php and i'm trying to get the contents of a standard html form to email through to my address. However upon submitting the form I get the following error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in E:\domains\s\spasolution.co.uk\user\htdocs\process2.php on line 23 Form code is pretty basic - <?php /*Set email recipient */ $email_from = "[email protected]"; ini_set('sendmail_from',$email_from); /* Sets the "sendmail_from" variable */ $myemail = "[email protected]"; /* sends the email to your email address */ $name = $_POST['name']; /* takes the "name" information from the previous form and sets it as $name */ $company = $_POST['company']; $address= $_POST['address']; $postcode = $_POST['postcode']; $phone = $_POST['phone']; $email = $_POST['email']; $interest = $_POST['interest']; $Subject = "Subject"; $headers = "FROM: $email_from .\n"; "Reply-To: $email_from .\n"; /* creates email headers, so the email appears to be from the email address filled out in the previous form. */ $message= "Name: " .$name . "\nCompany: " .$Company . "Address: " .$address . "\nPostcode: " .$Postcode . "\nPhone:" .$phone . "\nEmail:" .$email; $sent = mail($myemail, $Subject, $message, $headers '-f .$email_from'); if ($sent) { header ("Location: http://www.spasolution.co.uk/thanks.html"); } else { echo "There has been an error sending your comments. Please try later."; ) ?> Any help would be greatly appreciated as it's driving me nuts!! Link to comment https://forums.phpfreaks.com/topic/133637-form-to-email-help/ Share on other sites More sharing options...
JasonLewis Posted November 21, 2008 Share Posted November 21, 2008 What's this? $headers '-f .$email_from' Remove that last portion, after $headers. Link to comment https://forums.phpfreaks.com/topic/133637-form-to-email-help/#findComment-695261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.