1st post here so bear with me lol
just wanted to check my work here i have a form that validates a email address but with the change to php 5.3 now errors
can some one please look over my change and tell me what im missing as it not working
OLD WAY
function valid_email($email)
{
// check an email address is valid
if (ereg('^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$', $email))
return true;
else
return false;
}
NEW WAY
function valid_email($email)
{
// check an email address is valid
if (preg_match(('^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$', $email))
return true;
else
return false;
}
form sends with no email validation. i no its prob some thing simple but i cant work it out
thanks in advance