Validating numbers with regular expressions
<?php if (! preg_match('/^-?\d+$/'$_POST['rating'])) { print 'Your rating must be an integer.'; } if (! preg_match('/^-?\d*\.?\d+$/',$_POST['temperature'])) { print 'Your temperature must be a number.'; } ?>