This is part of a very basic contact form. The problem is that the email gets sent fine, but the variables specified in the $body come through as blanks, even though if I echo them they all have the correct values. Any ideas? Code below.
$name = $_POST['Your_Name']; $company = $_POST['Company_Name']; $tel = $_POST['Phone_Number']; $email = $_POST['E_Mail']; $details = $_POST['Details']; $to = "[email protected]"; $subject = "Enquiry from www.example.com"; $headers = "From: [email protected]"; $body = "An enquiry has been sent in from $name of $company.\n\nThe details are:\n $details\n\nPhone: $tel\nE-Mail: $email"; mail($to, $subject, $body, $headers); header( "Location: http://www.example.com/success.html" );
The e-mail arrives as below:
An enquiry has been sent in from of .
The details are:
… as you can see all the variables are empty, or at least not displaying. Any ideas???