Hi people, I’m very new to PHP and I want to put a javascript alert within a php thingo. The code I have looks like this:
$the_email = false;
if(eregi("^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", $_POST['email'])) {
$the_email = true;
} else {
echo "<script language=javascript> alert('Please enter a valid email address, or I will kill you); </script>";
$the_email = false;
}
if(!$the_email || !isset($_POST['name']) || !isset($_POST['message'])) {
echo "<script language=javascript> alert('Please enter your '+fName); </script>";
}
Can anyone see anything wrong with this? Any feedback would be appreciated.