Bug #12304 Updated: checkboxes

From: Date: Sun, 22 Jul 2001 09:34:07 +0000
Subject: Bug #12304 Updated: checkboxes
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60570@lists.php.net to get a copy of this message
ID: 12304 Updated by: zak Reported By: Eimerkopf@cinci.rr.com Status: Bogus Bug Type: Unknown/Other Function Operating System: win98 PHP Version: 4.0.4 New Comment: This is a browser issue - try this sample code: <form> <input type="checkbox" name="test" /> <input type="submit" /> </form> Note how when the checkbox is not selected and submit is pressed, the query string consists of only '?' If you need to keep track of what checkboxes are on a page, you could set a list in a hidden field and then use PHP to compare the list of fields in the hidden field to the fields passed to the form. Something like this: <input type="hidden" name="checkboxes" value="foo,bar" /> <?php foreach (explode (',', $checkboxes) as $field) { if (isset ($$field)) continue; $$field = 0; } ?> Previous Comments: ------------------------------------------------------------------------ [2001-07-22 05:31:16] cardinal@php.net Right, that's what's supposed to happen. As per the spec, browsers don't send checkboxes in the request if they weren't selected. ------------------------------------------------------------------------ [2001-07-22 00:52:25] Eimerkopf@cinci.rr.com does not recognise checkbox from html forms as a variable unless they are checked ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=12304&edit=1

« previous php.dev (#60570) next »