Hello I want to check if email is valid like blabla@blabla.com and not like just plain text 'BLbalbalba'.
I have this function:
function VerifyEmail($address)
{
$Syntax='#^[w.-]+@[w.-]+.[a-zA-Z]{2,5}$#';
if(preg_match($Syntaxe,$adrdess))
return true;
else
return false;
}
And checking it like this:
$email = htmlentities($_POST['email']);
if (!empty($email) && !empty($password) && !empty($message) && VerifyEmail($email) === true) {
Getting these errors:
Notice: Undefined variable: Syntaxe in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Notice: Undefined variable: adrdess in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Warning: preg_match() [function.preg-match]: Empty regular expression in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Notice: Undefined variable: Syntaxe in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Notice: Undefined variable: adrdess in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Warning: preg_match() [function.preg-match]: Empty regular expression in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Why is this happening? What did I do wrong? Is it a stable way of checking if email is valid? Thanks!