Page 1 of 1

validating input from forms

Posted: Mon Oct 30, 2006 4:48 am
by sh33p1985
quite simply for tieing up those loose ends of my form processing, id like to validate that some of the fields which require interger input (i.e. a number) are actually an integer and not a string so i can catch and handle the error.

e.g.
StockLevel = 100 (should be the correct input)
StockLevel = "fubar" (should throw an error)

something similar for prices which should be entered in xx.xx format.

im thinking regular expressions here, am i right?

Posted: Mon Oct 30, 2006 5:10 am
by theYinYeti
Wouldn't PHP's is_xxx functions work in this case? eg: is_integer($var)

Yves.

Posted: Mon Oct 30, 2006 5:11 am
by sh33p1985
super! thanks:)