Page 1 of 1

Why does PHP work in Firefox, Chrome, Opera but not IE8??

Posted: Thu Aug 05, 2010 1:05 am
by truelove
Greetings,

How could a PHP script work in every major browser except the oldest of them all - IE?

IE 8 REFUSES to execute a simple PHP form mailer: no error, no echo, no sent mail.

You can see the Form here: http://firelightchurch.com/

Script 1 below is the current and Script 2 is a more simple script that also works - just not in IE8.

Any advice is greatly appreciated!

Love!


======================
Script 1
======================

Code: Select all



<?php

// your name
$recipientname = "Happy Camper";

// your email
$recipientemail = "myemail@email.com";

// subject of the email sent to you
$subject = "Message from $recipientname";

// send an autoresponse to the user?
$autoresponse = "no";

// subject of autoresponse
$autosubject = "Thank you for your mail!";

// autoresponse message
$automessage = "This is an auto response to let you know that we've successfully received your email sent through our email form. Thanks! We'll get back to you shortly.";

// thankyou displayed after the user clicks "submit"
$thanks = "Thanks!";

// END OF NECESSARY MODIFICATIONS

?>



<?php
if($_POST['submit']) {

$name = $HTTP_POST_VARS['name'];
$email = $HTTP_POST_VARS['email'];
$message = $HTTP_POST_VARS['message'];

// check required fields

// check email address
if ((!ereg(".+\@.+\..+", $email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $email))){
$error .= "Invalid email address<br>";}

// display errors
if($error) {
?>

<b>Error</b><br>
<?php echo $error; ?><br>
<a href="#" onClick="history.go(-1)">try again</a>


<?php
}
else 
{

$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR;

// format message
$message = "Online-Form Response for $recipientname:

name: $name
email: $email

message: $message

-----------------------------

Browser: $browser
User IP: $ip";

// send mail and print success message
mail($recipientemail,"$subject","$message","From: $name <$email>");

if($autoresponse == "yes") {
$autosubject = stripslashes($autosubject);
$automessage = stripslashes($automessage);
mail($email,"$autosubject","$automessage","From: $recipientname <$recipientemail>");
}

echo "$thanks";
}
} 

?>


======================
Script 2
======================

Code: Select all

<?php



if(isset($_POST['submit'])) {

	$to = "myemail@email.com"; 
	$subject = "I have a question.";
	$name_field = $_POST['name'];
	$email_field = $_POST['email'];
	$message = $_POST['message'];
	$option = $_POST['radio'];
	$dropdown = $_POST['drop_down'];

	foreach($_POST['check'] as $value) {
		$check_msg .= "Checked: $value\n";
	}
	
	$body = "From: $name_field\n E-Mail: $email_field\n $check_msg Option: $option\n Drop-Down: $dropdown\n Message:\n $message\n $browser\n $ip\n";

	    
	 echo "Thank you!";
	mail($to, $subject, $body);
	
} else {
	echo "Something less than Wonderful happened!";
}
?>