note 34820 added to language.variables.external

From: Date: Thu, 07 Aug 2003 15:47:00 +0000
Subject: note 34820 added to language.variables.external
Groups: php.notes 
Request: Send a blank email to php-notes+get-53579@lists.php.net to get a copy of this message
if you use an array of checkboxes to submit info to a database or what have you, be careful of the case when no boxes are checked. for example: <form method="post"> <input type="checkbox" name="checkstuff[]" value="0"> <input type="checkbox" name="checkstuff[]" value="1"> <input type="checkbox" name="checkstuff[]" value="2"> . . . </form> if these are submitted and none are checked, the $_POST['checkstuff'] variable will not contain an empty array, but a NULL value. this bothered me when trying to implode() the values of my checkboxes to insert into a database, i got a warning saying the 2nd argument was the wrong type. hope this helps! -kevin ---- Manual Page -- http://www.php.net/manual/en/language.variables.external.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34820 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34820&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34820&report=yes

« previous php.notes (#53579) next »