On 6/14/07, Edward Kay <edward@xxxxxxxxxx> wrote:
> -----Original Message----- > From: Kevin Murphy [mailto:php@xxxxxxxxxxxxxxxxxx] > Sent: 14 June 2007 16:38 > To: php > Subject: Checking Phone Numbers > > > I collect phone numbers via a web form that breaks the phone number > up into 3 parts (3-digit area, 3-digit prefix, etc). Occasionally, I > am having people put in a phone number such as 999-999-9999 or > 000-000-0000 or other numbers that are all the same. How would I go > about comparing those three fields to see if they are all the same > numbers. I can't just exclude it anytime that the numbers all match, > for example 444 is a valid area code. It should only fail if all the > numbers are exactly the same. > > All the processes I've come up with seem to be rather convoluted. Is > there a simple way to test for this? > > -- > Kevin Murphy > Webmaster: Information and Marketing Services > Western Nevada College > www.wnc.edu > 775-445-3326 Whilst there are several ways to do this, it's not going to make someone entering dummy data give you their real phone number. They'll just enter another one that bypasses your check, e.g. 111-222-3333 or 321-321-4321. I'd also caution about forcing any specific format on telephone numbers. I'm in the UK and our phone numbers are in the format xxxx-xxx-xxxx, xxx-xxxx-xxxx or xxxxx-xxxxxx. This would not work with your form. If people are happy to give you their number, let them type it how it is. It could even include other characters, e.g. +44 (0)1234 567890 ex 324 Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
My suggestion is that we require the United Kingdom and other countries around the world to conform to our standards of telephone numbers. After all, isn't that what we do in America; change the world to meet our expectations or choose to shun them for not doing so? Nevermind.... that would go far beyond list topics and waaaay too far into the realm of political dissent. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php