Hello,
Spent all day yesterday reading about this and I still can't get it.
Perhaps my IQ is not much above room temperature...
My mySQL database is a simple inventory-type database with a "price" field
as an integer. The rest of my script relies on price being an integer so I
really don't want to change the data type.
I have a page with an HTML
form where the user can type in new entries into the database. In my HTML
form, I have the "price" field and I want the user to be able to type the
price any way they want. For instance for an item that costs $10,000 they
could type:
10000
10,000
10000.00
10,000.00
etc.
In the php script that the form posts to, I need to have some error
handling so regardless of how the user types the price on the form, it
will get entered into the database as an integer. I'm looking for
something along the lines of this:
if function_bad_characters($price)
{ $price=function_fix_bad_characters($price); }
and with this the user input in "price" is now reformatted so it gets
entered into the database as an integer.
I have tried all kinds of different regex recipes and str_replace magic
and nothing seems to be working. I'm frustrated enough at this point that
I just want one of you smart people to write it FOR me!!
Any help or pointers in the right direction is appreciated.
Thank you.
--
Will Clifton
wg*******@cox.net