Email Form Not Working In Safari Browser

Posted:
in Mac Software edited January 2014
I'm having a booger of a time getting an email form to work in the Safari browser (both MAC and MS versions).



Here's the code



Quote:

.

.

.

<body>



<?php



// Change below to the email address where you want to receive the message.

// (inside the quote marks '[email protected]'')

$myemail = '[email protected]';



// Change this to the subject of your message.

// (inside the quote marks 'PHP Mail Form Subject'')

$subject = 'PHP Mail Form Subject';



$op = $_POST[op];



if($op == 'contact')

{

$name = stripslashes($_POST[name]);

$email = stripslashes($_POST[email]);

$text = stripslashes($_POST[text]);



if(!eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$",$email))

{

$status = "We're sorry, but you've entered an incorrect email address.<br>";

}

if(!$name)

{

$status .= "Please enter your name.<br>";

}

if(!$text)

{

$status .= "Please enter a message.<br>";

}



if(!$status)

{

$header = "From: $email\

\

Reply-To: $email\

\

";



$message = "

Name: $name

Email: $email

Message: $text

";



if(mail($myemail, $subject, $message, $header))

{

$status = "Thank you for your Feedback!!<br><br>";

}

else

{

$status = "There was a problem sending your feedback, please try again later.<br><br>";

}



}

else

{

$status .= "<br>Please press <u>back</u> on your browser to resubmit.<br><br>";

}

}



// Now check the referer page and ensure it's a proper URL



$referer = $_SERVER[HTTP_REFERER];



if(!preg_match('#^http\\\\ : \\\\/\\\\/[a-z0-9\\-]+\\.([a-z0-9\\-]+\\.)?[a-z]+#i', $referer))

{

unset($referer);

}



?>



<?php print $status; ?>



<form method="post" action="<?php print $_SELF; ?>">

<input type="hidden" name="op" value="contact">

Name: <br>

<input name="name" size="35" value=""><br>

E-mail address: <br>

<input name="email" size="35" value=""><br>

<br>

Message: <br>

<textarea name="text" cols="50" rows="10"></textarea><br><br>

<input type="submit" value="Send message!">



</body>

.

.

.




which works fine in IE6, IE7, Firefox and Opera, properly showing one of two results:



1. if the inputs are correct the form will send an email and prompt



Thank you for your Feedback!!



2. if one or more inputs are absent or improper, the system will prompt



We're sorry, but you've entered an incorrect email address.

Please enter your name.

Please enter a message.

Please press back on your browser to resubmit.







However, when the same page is executed by a Safari browser, no matter if any or all input fields are populated, the screen returns to the "home" menu of the hosting website, no messages are shown, no email is sent.



I'm at a loss, hours of debugging and google searching have probed fruitless.
Sign In or Register to comment.