note 22744 added to function.empty

From: Date: Fri, 28 Jun 2002 06:12:59 +0000
Subject: note 22744 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-32358@lists.php.net to get a copy of this message
Just to save someone the hours of teeth-grinding I just went through, a CheckBox form field does NOT show up as set, if it is not checked. If you go to a page without submitting a form, $_POST["checkboxName"] will evaluate as the following: empty($_POST["checkboxName"]) == true isset($_POST["checkboxName"]) == false ("" == $_POST["checkboxName"]) == true If you then submit the form with $_POST["checkboxName"] UNclicked, it will evaluate as the following: empty($_POST["checkboxName"]) == true isset($_POST["checkboxName"]) == false ("" == $_POST["checkboxName"]) == true There is no difference as far as PHP is concerned. This is a pain in the butt for me, and hopefully it will be corrected sometime. I would *expect* that in the second instance, isset would be TRUE. -- http://www.php.net/manual/en/function.empty.php http://master.php.net/manage/user-notes.php?action=edit+22744 http://master.php.net/manage/user-notes.php?action=delete+22744 http://master.php.net/manage/user-notes.php?action=reject+22744

« previous php.notes (#32358) next »