Possible Duplicate:
php validate integer
How would I generally validate a user input is an integer? I mean i receive a variable throught $_GET and this must be an integer.
Possible Duplicate:
php validate integer
How would I generally validate a user input is an integer? I mean i receive a variable throught $_GET and this must be an integer.
You could use:
preg_match('/^[0-9]+$/', $_GET['variable_name']);
You should probable use the is_numeric() function or maybe the is_int() function if you plan on just working with integers and not other types such as floats.