Click to See Complete Forum and Search --> : checking fields


bunny1
03-19-2007, 05:52 PM
i am checking that a field only contains numbers using the following code

preg_match('/^[0-9\" "]*$/')

i want to allow a decimal point in this field.
How can i make sure the only non numerical character allowed is a "."

thanks

bokeh
03-19-2007, 06:17 PM
Use is_numeric() instead of preg_match would be easiest.

bunny1
03-19-2007, 06:20 PM
thank you