Okay so fairly straight forward php contact form. It submits and sends the data in ie and takes the user to a thank you page. However in both google chrome and firefox, my users are taken to the thank you page but their form data is not sent to the email.
This is the code I am using:
Form Data on one page
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_wl.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">First Name</td>
<td width="2%">:</td>
<td width="82%"><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<tr>
<td width="16%">Last Name</td>
<td width="2%">:</td>
<td width="82%"><input name="lastname" type="text" id="lastname" size="50"></td>
</tr>
<tr>
<td>Address</td>
<td>:</td>
<td><textarea name="address" cols="50" rows="4" id="address"></textarea></td>
</tr>
<tr>
<td>Date of Birth</td>
<td>:</td>
<td><input name="dob" type="date" id="dob" size="50"></td>
</tr>
<tr>
<td>Health Care Number</td>
<td>:</td>
<td><input name="phn" type="text" id="phn" size="50"></td>
</tr>
<tr>
<td>Phone</td>
<td>:</td>
<td><input name="ac" type="text" id="ac" size="3"><input name="phone" type="text" id="phone" size="7"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="email" type="text" id="email" size="50"></td>
</tr>
<tr>
<td>Comments</td>
<td>:</td>
<td><textarea name="comment" cols="50" rows="4" id="comment"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
php script on another pages "send_wl.php"
<?php
$to = "ouremail@gmail.com";
$from = $_POST['email'] ;
$name = $_POST['name'] ;
$headers = "From: $from";
$subject = "New Patient Data";
$fields = array();
$fields["name"] = "name";
$fields["lastname"} = "lastname";
$fields["address"] = "address";
$fields["email"] = "email";
$fields["ac"] = "ac";
$fields["phone"] = "phone";
$fields["dob"] = "dob";
$fields["phn"] = "phn";
$fields["comment"] = "comment";
$body = "We have received the following information:
"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s
",$b,$_REQUEST[$a]); }
$headers2 = "From: noreply@ourwebsite.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.ourwebsite.com";
if($from == '') {print "You have not entered an email, please go back and try again";
} else {
if($name == '') {print "You have not entered a name, please go back and try again";
} else {
$send = mail($to, $subject, $body, $headers);
}
if($send)
{header( "Location: http://www.thewebsite.com/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify mailreciepient@gmail.com"; }
}
}
?>
I have made all the suggested changes to the web site as well and this form is still not working.
Should I also be removing the = "lastname" from the $fields["lastname"] = "lastname" I know it seems like a stupid question but I am honestly pulling my hair out on this one.