...

View Full Version : Resolved how come this simple php mail script wont work in ie



kevinkhan
03-22-2010, 02:28 PM
<?php if(isset($_POST['submit']))
{
echo "hello";
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$comments = $_POST['comments'];


$to = "info@projectorhire.ie";
$subject = "Projector Hire Inquiry!";
$body =

"\nName: " . $firstName . " " . $lastName .
"\nEmail: " . $email .
"\nPhone Number: " . $mobile .
"\nMessage: " . $comments;

$headers = "From: ". $firstName ." ". $lastName . " <" . $email . ">\r\n";


if (mail($to, $subject, $body, $headers)) {
echo("<p class=\"errors\">Thanks for submitting your enquiry.</p>");
}
else {
echo("<p class=\"errors\">Message delivery failed. Please fill in or Quick Contact Form again or call us on 087-9850714 to get immediate assistance.</p>");
}
}

?>
</span>
<form id="form" method="post" action="index.php#anchor" >
<p>
<label>First Name</label>
<input type="text" id="firstName" name="firstName" value="" />
</p>
<p>
<label>Last Name</label>
<input type="text" id="lastName" name="lastName" value="" />
</p>
<p>
<label>Email:</label>
<input type="text" id="email" name="email" value="" />

</p>
<p>
<label>Phone:</label>
<input type="text" id="mobile" name="mobile" value="" />

</p>
<p>
<label>Comments:</label>
<textarea name="comments" id="comment" cols="30" rows="3" ></textarea>
</p>
<p> <input class="submit" type="image" src="images/submit.gif" name="submit" value="submit" /></p>
</form>


it works in firefox but not in Ie for some weird reason...

Check www.projectorhire.ie for live version

Let me know if you know what the problem is

Thanks

_Aerospace_Eng_
03-22-2010, 02:46 PM
Change this

if(isset($_POST['submit']))
to this

if(isset($_POST['submit_x']))
And it shoul work in all browsers. When using an input type="image" IE sends the x and y values of where the user clicked on the image. Firefox does this too but I believe it still sends the normal name of the button as well.

kevinkhan
03-22-2010, 03:00 PM
Change this

if(isset($_POST['submit']))
to this

if(isset($_POST['submit_x']))
And it shoul work in all browsers. When using an input type="image" IE sends the x and y values of where the user clicked on the image. Firefox does this too but I believe it still sends the normal name of the button as well.

That worked alright..

Thats strange..

Thanks :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum