Hi,
I'm having some trouble with a basic contact form on my site. We recently had register globals switched off because of the security concerns etc and now our contact form is no longer working.
The form appears to be processing as we get the thank you / confirmation message, but the emails are coming through blank i.e.:
name:
email:
phone:
etc..
This is the code for our form:
<form name="form3" method="post" action="contact.php?send=1">
<div style="border:solid 1px #eb8c00; width:450px;">
<table width="427" border="0" cellpadding="5">
<tr>
<td width="156" align="right" valign="top">Name</td>
<td width="245"><input type="text" name="name" class="textfield" size="35"/></td>
</tr>
<tr>
<td align="right" valign="top">Address</td>
<td><textarea name="address" class="textfieldmulti" rows="4" cols="35"></textarea></td>
</tr>
<tr>
<td align="right" valign="top">Telephone Number</td>
<td><input type="text" name="telephone" class="textfield" size="35"/></td>
</tr>
<tr>
<td align="right" valign="top">Mobile Number </td>
<td><input type="text" name="mobile" class="textfield" size="35"/></td>
</tr>
<tr>
<td align="right" valign="top">Email Address</td>
<td><input type="text" name="email" class="textfield" size="35"/></td>
</tr>
<tr>
<td align="right" valign="top">Your Enquiry</td>
<td><textarea name="enquiry" class="textfieldmulti" rows="8" cols="35"></textarea></td>
</tr>
<tr>
<td><input type="hidden" name="mail" value="1"/></td>
<td><input type="submit" name="Submit3" value="Send" class="button"/></td>
</tr>
</table>
</div>
</form>
This is the php code we're using:
$mail = $_POST['mail'];
if($mail == 1){
$mailTo = "info@xxxxxxxxx.com";
$mailSubject = "Enquiry from your website";
$mailBody = "Name : $name\n";
$mailBody .= "Address : $address\n";
$mailBody .= "Telephone : $telephone\n";
$mailBody .= "Mobile Number : $mobile\n";
$mailBody .= "Email Address : $email\n\n";
$mailBody .= "Enquiry : $enquiry";
$mailHeaders = "From: collector@xxxxxxx.com";
mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
header("Location:contact2.php");
}
Can anyone offer any advice as to how I can go about fixing this? I think its down to the register globals thing, but if anyone can help that would be great.
Many thanks