Re: [PHP] verify phone number

2001-05-11 Thread Sean Cazzell
> I am looking for code to verify a phone number has been entered correctly on > a form field. Requirements would include the area code: xxx-xxx-. You should use a regex for this. Something like... if (ereg ("[0-9]{3}-[0-9]{3}-[0-9]{4}", $number)) { print "good\n"; } else {

RE: [PHP] verify phone number

2001-05-11 Thread Johnson, Kirk
One way: $phone = ereg_replace("[^0-9]", "", $phone); if(!ereg("^[0-9]{10}$",$phoneHome")) { echo "error"; } You could also check the string length after removing all non-numbers. Kirk > -Original Message- > From: Claudia Smith [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 11, 2001