View Full Version : php and checkboxes
10-26-2005, 05: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, 07: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-27-2005, 12:47 AM
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.