Re: Number formatting

From: Date: Mon, 08 Jan 2001 19:41:48 +0000
Subject: Re: Number formatting
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33291@lists.php.net to get a copy of this message
I know there are multiple was to do this but my favorite is: (<input type=text length=3 maxlength=3>)&nbsp;<input type=text length=3 maxlength=3>-<input type=text length=4 maxlength=4> ext: <input type=text length=5 maxlength=5> And then check the variables to make sure they are numbers and then concat all of those in the format you want. -NC ----- Original Message ----- From: "Ashley M. Kirchner" <ashley@pcraft.com> To: "PHP-General List" <php-general@lists.php.net> Sent: Monday, January 08, 2001 12:13 PM Subject: [PHP] Number formatting > > 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. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#33291) next »