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 4:52 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] verify phone number
>
>
> 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-xxxx.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]