The problem you have is that not all phone numbers share that format... mine for example (Australia) is 61 3 XXXX XXXX (that is, CountryCode, State, Exchange, Number). So it depends on who will fill out your form... if you're talking international, you may want to think twice.
It never ceases to frustrate me when global sites (usually based in the US I've found) tend to think that "their way" is the only way. Countless times where the the number format of phone numbers wouldn't let me enter my number correctly, or the state abbreviation was only 2 chars (Australia is 3, eg VIC), only allowing me to select a US state (no "other" option) -- but still allowing me to select "Australia" from the country list, etc etc. The best way to make people conform is to break the number into multiple boxes, for country code, area code, and number. You can then join them with a -, and even do some small manipulations on the last one (eg putting a - after 4 chars, or whatever), check they're all filled out, and then insert the completed, correctly formatted number into the database :) Cheers, Justin PS there might be a class to validate to a correct international number format, which MAY give you what you want. on 11/09/02 1:30 AM, Jeff Lewis ([EMAIL PROTECTED]) wrote: > Just wondering what the best way to validate an entered phone format is? Is > anyone doing this currently? > > I have a form field that people enter in information and I want to force > phone entries to XXX-XXX-XXXX. > > Jeff > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php