I created a form which works in Chrome and IE, but not Firefox. On submit, it simply goes to a blank screen with the URL of my PHP file, sendContact.php.
Here’s the markup:
<form action="script/sendContact.php" method="post" class="contactForm">
<div class="textBoxDivs">
<label>Name</label>
<br />
<input type="text" id="name" name="name" size="40" class="textField"/>
</div>
<div class="textBoxDivs">
<label>Phone</label>
<br />
<input type="text" id="phone" name="phone" size="40"class="textField"/>
</div>
<div class="textBoxDivs">
<label>Email</label>
<br />
<input type="text" id="email" name="email" size="40"class="textField"/>
</div>
<div class="textArea">
<label>Please describe what services you will require and your proposed budget.</label>
<br />
<textarea id="message" cols="40" rows="7" name="message" class="textAreaField"> </textarea>
</div>
<div class="formButtonDiv">
<input type="submit" value="submit" class="formBut"/>
<input type="reset" value="reset" class="formBut" />
</div>
</form>
and the PHP is as follows:
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$phone = $_POST['phone'];
$formcontent= "From: $name \n Email: $email \n Phone: $phone \n Message: $message";
$recipient = "al@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $userEmail \r\n";
if (mail($recipient, $subject, $formcontent, $mailheader, $email))
{
header ("Location: thankYou.html");
} else {
echo "mail was not sent";
}
I’ve tried on Firefox right now, and every thing went fine. By the way, looking at your php code, you should check if the form is ok before sending it. I’ve tried with empty field and I guess you just receive a mail from nobody..
Try something like: