Hello,
This says its working but I dont see it when I check my email it shows new email but when I open it doesnt show the name, email or message.
Any ideas what I did wrong?
Thanks,
Mike
Hello,
This says its working but I dont see it when I check my email it shows new email but when I open it doesnt show the name, email or message.
Any ideas what I did wrong?
Thanks,
Mike
You’ll need to show the code you are using to process the form.
Here is the php for the contactengine.php…
<?php
$EmailFrom = $_POST['email'];
$EmailTo = "info@godfatherrecords.com";
$Subject = "Godfather Records Email Form";
$name = Trim(stripslashes($_POST['Name']));
$email = Trim(stripslashes($_POST['Email']));
$comments = 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 .= "\
";
$Body .= "Email: ";
$Body .= $email;
$Body .= "\
";
$Body .= "Message: ";
$Body .= $comments;
$Body .= "\
";
// 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\\">";
}
?>
Check the name of your form fields and make sure these are correct:
$name = Trim(stripslashes($_POST['Name']));
$email = Trim(stripslashes($_POST['Email']));
$comments = Trim(stripslashes($_POST['Message']));
From what I can tell, it should be
$name = Trim(stripslashes($_POST['name']));
$email = Trim(stripslashes($_POST['email']));
$comments = Trim(stripslashes($_POST['comments']));
Yes, it’s better never to use capitals in code (except perhaps when camel casing), as it’s just one extra way to get things messed up.
And I believe it’s better to use underscore to divide variable name than using camel casing. It describe the variable better.
But of course it’s up to the programmer’s style.