Jump to content

Form to email help!!


mschneikert

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.