Re: empty() problem
| From: | adwin wijaya | Date: | Sun, 12 Dec 2004 23:04:15 +0000 |
| Subject: | Re: empty() problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204121@lists.php.net to get a copy of this message | ||
Ahmed Abdel-Aliem wrote:
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. can i use another function that doesn't return false when the 0 is passes ? any help plz ?try to use isset() instead of empty. empty() will be true if: 1. it contains 0 2. it is empty 3. or it contains white space. but, for example if $x = ' ' ; .. isset() will return true instead of false. So try to trim($x) before doing isset. cmmiw -- ======================= Best Regards Adwin Wijaya www.kuya-kuya.net www.e-rhema.net =======================