
Originally Posted by
gusblake
how does php check whether a checkbox has been ticked in a form?
It doesn't, not directly anyway. The checked state of a checkbox determines if it is a successful control. Successful controls are submitted as part of the form data, whereas unsuccessful controls aren't submitted at all.
If the name of that control is part of the $_GET or $_POST superglobals (depending on the submission method), you know it was successful. If not, then the box was unchecked.
Code:
if(isset($_GET['control-name'])) {
/* Checked */
}
Mike
Bookmarks