When I submit a HTML form with a checked checkbox that doesn\'t have an explicitly defined value
, Chrome sends on
as a value for that field.
Browsers will send the value of a checkbox (in the POST data) only if it is checked. A check to see if a value (any value) for a particular checkbox is present in the POST data is all you need.
i.e.
// no need to check against 'on', 'true', '1' etc..
if(post data contains a value for checkbox1) {
// checkbox 1 is checked
}
else {
// not checked
}