Page 1 of 1

Phone number not displaying in confirmation email

Posted: Mon Dec 05, 2011 8:26 am
by ralphiedee
In the confirmation Email I receive when someone uses the contact form I get all the info EXCEPT the phone number ( it is blank ) script is below

<?php

$EmailFrom = "Million-heirs.com";
$EmailTo = "admn@million-heirs.com,vze2btvh@verizon.net";
$Subject = "Million-heirs.com";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));

// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

Re: Phone number not displaying in confirmation email

Posted: Mon Dec 05, 2011 8:31 am
by Celauran
The code itself looks fine (though it would look better wrapped in syntax tags). Have you tried echoing $Tel?

On an unrelated note, this is a little pointless:

Code: Select all

$validationOK = true;
if (!$validationOK)

Re: Phone number not displaying in confirmation email

Posted: Fri Dec 09, 2011 7:12 am
by phphelpme
I would check to see if your name for your input matches your:

Code: Select all

$Tel = Trim(stripslashes($_POST['Tel'])); 
Is it named: Tel or tel for instance and that could be why your not getting the variable. Check your variable to see if it is empty or not. :)

Don't really know why this is used though:

Code: Select all

// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
Is there something missing from your code that we are not seeing here? ;)