Is there a way to check of a checkbox is unchecked with php? I know you can do a hidden field type in html but what about with just php when the form is submitted? I tried b
This is an old question, but for people looking for this....
Better approach to Matt's answer is to use $_SERVER['REQUEST_METHOD'] to check if form was submitted:
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
//form was submitted...let's DO this.
if (!isset($_POST['checkboxname'])) {
// checkbox was not checked...do something
} else {
// checkbox was checked. Rock on!
}
}