|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-22 00:52 UTC] Eimerkopf at cinci dot rr dot com
does not recognise checkbox from html forms as a variable unless they are checked PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 23:00:01 2025 UTC |
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; } ?>