hi.. i put this email validation function and when i tried it, the following error comes out: 😕
Notice: Undefined offset: 1 in c:\inetpub\wwwroot\test\email.php on line 17
thanks in advance... 🙂
have any code to go with that error?
oh yeah,
function IsEmailSyntaxValid($addr) { list($local, $domain) = explode("@", $addr); // this is line 17 $pattern_local = '([0-9a-z]([-|]?[0-9a-z]+))(([-|]?).([-|]?)[0-9a-z]([-|]?[0-9a-z]+)+)([-|_]?)$'; $pattern_domain = '([0-9a-z]+([-]?[0-9a-z]+))(([-]?).([-]?)[0-9a-z]([-]?[0-9a-z]+)+)*.[a-z]{2,4}$'; $match_local = eregi($pattern_local, $local); $match_domain = eregi($pattern_domain, $domain); if ($match_local && $match_domain) return 1; else return 0; }
its a code for validating email address.
The string you're passing to the function ("$addr") doesn't contain "@".
hmmm yeah. thanks! 🙂