Forum Moderators: coopster
Any example?
if ( isset($_POST['postcode'])
&& is_numeric($_POST['postcode'])
&& is_int($_POST['postcode'] + 0)
)
basically, line by line
- is the variable set?
- post data from an <input> is a string, so we check whether the string is numeric
- if it is, we cast it as a number (which type depends on the data) by adding zero (or multiplying by 1) and check to see whether the number is an integer of a float.
Tom