I've set this to validate the email address. If it passes, it sends the email. If it fails, it closes the users browser. One minor prob...not quite working. Fix? Thanks
function valid_email($email) {
if(ereg("^([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])*$",$email)) {
return TRUE;
} else {
return FALSE;
}
}
if (valid_email($email)) {
$mail_fn=mail($email,$subject,$message_n,$headers);
}
else {
echo "<html><head><script>window.onload = function() {self.opener = this;self.close();}</script></head></html>";
}
if($mail_fn==0)
{
echo "ERROR";
}
else {
header ("Location: [url]http://site.com/confirm.php[/url]");
}