View Full Version : php and checkboxes
10-26-2005, 04:28 PM
how does php check whether a checkbox has been ticked in a form? i thought of making a js function that wrote something into a hidden text box according to whether the checkbox was ticked or not, but is there a simpler way with php?
10-26-2005, 06:04 PM
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.
/* Checked */
10-26-2005, 11:47 PM
Powered by vBulletin® Version 4.2.1 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.