I have pretty basic PHP knowledge. I have set up a contact form which works well, however I seem to be receiving blank emails.
I used dreamweaver to perform validation on the submit button so I don't understand how this is happening.
Any help would be much appreciated.
form.html code -
<form id="form1" name="form1" method="post" action="mailer.php">
<label>Name: </label>
<input name="Name" type="text" id="name" size="20" />
<label>Phone: </label>
<input name="Phone" type="text" id="phone" size="20" />
<label>Best time to call: </label>
<input name="Time" type="text" id="time" size="20" />
<input name="submit" type="submit" id="submit" onclick="MM_validateForm('name','','R','phone','','R','time','','R');return document.MM_returnValue" value="Submit" />
</form>
mailer.php code -
<?php
// get posted data into local variables
$EmailFrom = "";
$EmailTo = "";
$Subject = "";
$Name = Trim(stripslashes($_POST['Name']));
$Phone = Trim(stripslashes($_POST['Phone']));
$Time = Trim(stripslashes($_POST['Time']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Time: ";
$Body .= $Time;
$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=thank_you.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>