Number formatting
| From: | Ashley M. Kirchner | Date: | Mon, 08 Jan 2001 19:13:22 +0000 |
| Subject: | Number formatting | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-33285@lists.php.net to get a copy of this message | ||
I have a standard <form> page that passes the information to a PHP
script which in turn feeds the data to an mySQL database. What I'd like
to do is have some sort of consistency in some of the fields, especially
the phone number field.
As people fill in their data, I'm finding out that putting a little
command on the <form> page (stating how to enter the phone number) gets
completely ignored, and I get stuff like this in the DB:
123-555-1212
123.555.1212
(123) 555-1212
(123) 555 1212
123) 555 1212
1235551212
(123)555-1212
123 555 1212
123/555/1212
...some add extra characters behind it, like 'ext' (for extension)
and 'or' (for listing a second number). However, the field in the
<form> page is just long enough for 15 characters, so they'll never be
able to enter anything more.
Is there an easy way to convert this gibberish data into a standard
format prior to feeding it to the DB, say (123) 555-1212 or whatever
other format I want to use?
AMK4
--
H | Hi, I'm currently out of my mind. Please leave a message. BEEEEP!
|____________________________________________________________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ashley M. Kirchner <mailto:ashley@pcraft.com> .
303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . eFax 248.671.0909
http://www.pcraft.com . 3550 Arapahoe
Ave, #6
.................. . . . . Boulder, CO 80303, U.S.A.