Hi, I'm really new to PHP so please be gentle. I have created a contact form for a friend but when I submit the form - it goes to the right address but all of the variables are blank.
I'm totally stuck - can anyone help?
php code is
I'm totally stuck - can anyone help?
php code is
Code:
<?php
$EmailFrom = "info@govandentalcare.co.uk";
$EmailTo = "conniemurray1@hotmail.com";
$Subject = "online form";
$Name = trim(stripslashes($_POST['Name']));
$Email = trim(stripslashes($_POST['Email']));
$Tel = trim(stripslashes($_POST['Tel']));
$Message = trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
echo "please check your details";
header("Location: http://govandentalcare.co.uk/contactjan.php");
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=\"1;URL=thanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";
}
?>
Comment