note 32458 added to language.variables.external

From: Date: Wed, 28 May 2003 10:37:32 +0000
Subject: note 32458 added to language.variables.external
Groups: php.notes 
Request: Send a blank email to php-notes+get-49162@lists.php.net to get a copy of this message
A further thought about the checkbox without check mentioned above. Rather than writing in a HIDDEN element. Why not have your validation code check for the variable of the checkbox like so: Assume HTML form has the following unchecked checkbox: <INPUT TYPE='CHECKBOX' NAME="CATEGORY[]">Category Name</INPUT> then your ACTION script in the form points to a script which has: if (!isset($checkbox)) { CATEGORY[] = "off"; } If you were dynamically creating the checkboxs, then, most likely, you would have your hands on the keys for each CATEGORY and you could create something like: while (list($cat_id,$cat_title) = each($categories)) { if (isset($category)) { if (!$category[$cat_id]) { $category[$cat_id] = "off"; } else { $category[$cat_id] = "on"; } } else { $category[$cat_id] = "off"; } } Assuming that you have an array named $categories constructed with unique keys and category titles. ---- Manual Page -- http://www.php.net/manual/en/language.variables.external.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32458 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32458&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32458&report=yes

« previous php.notes (#49162) next »