Re: validate phone numbers
| From: | (Miles Thompson) | Date: | Wed, 20 Jun 2001 19:16:18 +0000 |
| Subject: | Re: validate phone numbers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54590@lists.php.net to get a copy of this message | ||
There are so many combinations of European phone numbers, along with the possible combinations of area codes, and hyphens or spaces may be used as well, I wouldn't bother. If the phone number is critical, and important to the person using your site, then treatitlike a password and have them enter it twice. Although in that case they are likely to enter it correctly anyway.
One can only do so much.
Miles Thompson
At 07:24 PM 6/19/01 -0700, Richard Kurth wrote:
I am using this script to validate for phone numbers and it work just perfect for US phone numbers. But it rejects some European and Australian numbers what do I need to do to make it validate all phone numbers if (($WPHONE_NO) || ($wphone_no)) { $wphone_no = trim($wphone_no); if ($WPHONE_NO)$phone_no = trim($WPHONE_NO);if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $wphone_no)) {print_error("your <b>phone number</b> is invalid");} } Best regards, Richard mailto:rkurth@pacifier.com