mail() function passing empty variables to my e-mail body :(

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.

[php]<?php
{
ini_set(“SMTP”, “smtp1.example.com”);

$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" );

}
?>[/php]

The e-mail arrives as below:

An enquiry has been sent in from of .

The details are:

Phone:
E-Mail:

… as you can see all the variables are empty, or at least not displaying. Any ideas???

Hi mate,

The good news is, i’ve studied your code till my eyes bled… no mistakes there…

the bad news is, that don’t help you except you have proved your script is fine…

the only thing that looks weird to me are the brackets that open and close??
(i assume their part of a ‘bigger’ picture?)

Good luck sorting it out and sorry i couldn’t be of any help… :’(

Red. :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service