note 32458 deleted from language.variables.external by danbrown

From: Date: Wed, 09 Mar 2011 14:43:39 +0000
Subject: note 32458 deleted from language.variables.external by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177714@lists.php.net to get a copy of this message
Note Submitter: mraymer at universal-solutions dot net ---- 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.

« previous php.notes (#177714) next »