note 30103 deleted from faq.html by vrana

From: Date: Tue, 17 Aug 2004 13:34:35 +0000
Subject: note 30103 deleted from faq.html by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74814@lists.php.net to get a copy of this message
Note Submitter: Ronan dot Minguy at wanadoo dot fr ---- USING CHECKBOXES IN A FORM If you're using a checkbox in a form and want test if the checkbox was checked, you must not specify any value in the checkbox input, otherwise it won't work. Id est : echo "<input type=\"checkbox\" name=\"cb\"> will work you can then test after submitting the form like this if ($cb) { //what to do if the box was checked } else { //what to do if the box wasn't checked } but echo "<input type=\"checkbox\" name\"cb\" value\"$cb\"> won't work. If your using the same "if" instruction than above, it will be always false. Believe me I spend hours wondering why it wasn't working! Ronan

« previous php.notes (#74814) next »