Hello all,
I am having a hard time trying to figure out why I can't get my code to successfully check my email address. It seems I can plug in anything and it won't give me an error.
This is my code for that line:
<?php
session_start();
if((!empty($_POST['email'])
&& (preg_match('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email']) <50)))
{
$email=$_POST['email'];
$email=htmlspecialchars($email);
$_SESSION['email'] = $email;
}
else
{
$errors[]= 'You forgot to enter a valid E-mail Address!';
}
if (empty($errors))
{
header
("Location:http://www.thisnextpage.php");
exit();
}
if (!empty($errors) && is_array($errors))
{
echo '<h1>Error!</h1>
The following error(s) occured:<br/ >';
foreach ($errors as $msg)
{
echo " - $msg<br />\n";
}
}
?>
When I type in just letters and don't include @ it accepts it and moves me right along. It's supposed to stop me and tell me to enter a valid email address. Hmmmm...
Any help will be appreciated :)
~Amy