why does this fail when comparing to a name(alpha only)?
if (!ereg("[a-zA-Z]$",$f_name))
TIA
if (!ereg("^[a-zA-Z]+$",$f_name))
Hope this helps 😉
thanks for that...one more thing...how do you account for a space? like spaces in a street address. i tried
if (!ereg("[A-Za-z0-9#-]+$",$street)){
with the $street="159 rouge forest cres"
but still having a problem
I think "\s" and "\ " will both match a space. Give it a try.
still stuck here
//check that all data for street is only a-z, numbers (incl number sign) and the hyphen if (ereg("[A-Za-z0-9#-.\s]+$",$street)){ echo "ok street"; }else{ $street="error"; echo "error str"; $errors=1;
}
where $street is the same as above
Avoid ereg, it's crippled. The perl compatible functions are much better:
$street="159 rouge forest cres"; if (preg_match("/^[A-Za-z0-9#-.\s]+$/",$street)){ echo "ok street"; }else{ $street="error"; echo "error str"; $errors=1; }