hey guys. cant see what im doing wrong here.
see comment // heres is where the issue begins in the code.
all works well till it gets to the eregi to validate the email then it just stops. it doesnt seem to want to pass that ielseif onto the "elseif (!$_POST['phone'])" bit
thanx in advance..
even if anyone has any ideas as to tidyin up the code let me know.
TW
<?
if(!$_POST ['name'])
{
$name_error = '<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><<-- Please enter your name</a>';
//echo $name_error;
}
elseif (!$_POST['subject'])
{
$subject_error = '<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><<-- Please enter a subject</a>';
//echo $subject_error;
}
elseif (!$_POST['body'])
{
$body_error = '<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><<-- Please enter a message</a>';
//echo $body_error;
}
elseif (!$_POST['senderx'])
{
$email_error = '<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><<-- Please enter an email address</a>';
//echo $email_error;
}
// heres is where the issue begins
elseif (!eregi("^[a-z0-9._-]+@[a-z0-9._-]+.[a-z]{2,4}$", $_POST['senderx'])) {
$email_error = '<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><<-- your email is not valid</a>';
echo $email_error;
}
elseif (eregi("^[a-z0-9._-]+@[a-z0-9._-]+.[a-z]{2,4}$", $_POST['senderx']))
{
$email_error = 'email is validated';
echo $email_error;
}
elseif (!$_POST['phone'])
{
$phone_error = '<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><<-- Please enter a phone number</a>';
//echo $phone_error;
}
elseif (!$_POST['mobile'])
{
$mobile_error = '<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true"><<-- Please enter a mobile number</a>';
//echo $mobile_error;
}
elseif ($word_ok!==false)
{
if($word_ok=="yes")
{
$_SESSION['name'] = $_POST ['name'];
$_SESSION['senderx'] = $_POST ['senderx'];
$_SESSION['phone'] = $_POST ['phone'];
$_SESSION['mobile'] = $_POST ['mobile'];
$_SESSION['subject'] = $_POST ['subject'];
$_SESSION['body'] = $_POST ['body'];
// echo var_dump($_SESSION);
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'contact_done_new.php';
header("Location: http://$host$uri/$extra");
exit;
}
}
?>