I'm not sure what I'm missing here... I have an input box for email addresses were the user can enter multiple addresses - comma separated. However, when I try to validate multiple addresses it only throws the first address as valid the rest are invalid:
my code:
$TO_EMAIL = "bob2@bob2.com, bob1@bob1.com, bob@bob.com";
$MULTI_EMAIL_CHECK = explode(',', $TO_EMAIL);
$c = 1;
foreach($MULTI_EMAIL_CHECK as $value){
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $value)){
$error_msg = "!Invalid Email Address - Please Try Again.";
$to_email_error = 'YES';
}
echo $c." - ".$value." - ".$error_msg."<br/>";
$c++;
}
I know mr. brad will argue that a "+" sign in an email address is valid ; ) and I will address that in a bit but for the time being I am little stumped by this.
any insight is appreciated.