Hi Group Members
i have a problem with function empty() i use it to check if user entered the form fields and store it in array
for example :
if (empty($Game_rating)) $errors[] = "You didn't enter the Online Status for the Game.";
the problem when the user enters 0 in the form field the empty function returns the error.
Is $Game_rating supposed to be an integer? If so, then make it one and check for <= to zero.
if(!isset($_Game_rating) || (int)$Game_rating <= 0) { $errors[] = "You didn't enter the Online Status for the Game."; }
Now you _know_ $Game_rating is an integer above zero and is safe to display and/or put into a query.
Simply checking for
if($Game_rating == '')
will throw notices on some setups about an undefined variable (depending upon error_reporting level) and will allow text through when it's supposed to just be an integer.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php