I've put together a small script which captures a users email address and writes them as comma seperated values to a file called maillist.php, but the first part, the actual submission of the email address seems to not work in IE7. Yet, the script functions just fine firefox. so what am I missing???
Here's my URL: http://www.search-pirate.com/newsletter.php
Here's my code:
<?
$email = $_REQUEST["email"];
if ((!isset($_POST['submit2']))) {
?>
HTML CODE for the form HERE, The form action is "PHP_SELF".
<?
} else {
// Check if Email validity
$eregs = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
if (!eregi($eregs, $email)) {
echo '<p>Error</p>';
echo '<p class="arial2">Avast! That was an invalid E-mail address!</p>';
echo '<p class="arial2"><a href="javascript:history.go(-1)">Back</a></p>';
exit();
}
// Check if email already exists
$list = file_get_contents("newsletter/maillist.php");
if(stristr($list, $email)) {
echo '<p>Error</p>';
echo '<p class="arial2">Avast! The E-mail addresses <span style="color:red">'.$email.'</span> is already in the newsletter!</p>';
echo '<p class="arial2"><a href="javascript:history.go(-1)">Back</a></p>';
exit();
}
// Check if an Email address has to be added, and add to the list via "," seperated values
$list = file_get_contents("newsletter/maillist.php");
if (strlen($list) == 0){
$newitem = $email;
} else {
$newitem = ', '.$email;
}
// Add it to the file
$openmail = fopen("newsletter/maillist.php", "a+");
fwrite($openmail, $newitem);
fclose($openmail);
echo '<p>Success!</p>';
echo '<p class="arial2">Shiver me timbers! Yer E-mail <span style="color:red">'.$email.'</span> was added to the newsletter!';
echo '<p class="arial2"><a href="/index.php">Return Home</a></p>';
}
?>
Any help would be greatly appreciated, this has been driving me nuts! :mad: