I was also faced that problem the unchecked checkboxes cannot submit the data when submit form, so I decided to a write a jquery,
here is my html
[html]
<input type="checkbox" value="1" checked="checked" named="checked_checkbox" />
<input type="checkbox" value="1" named="un_checked_checkbox" />
[/html]
When I using print_r($_POST) ;
its just return
[php]
Array (
[‘checked_checkbox’] = 1
)
[/php]
and here is #jQuery code to show both unchecked and checked checkboxes
[javascript]
$("form").submit(function () {
//WHEN FORM WILL SUBMIT
var this_master = $(this);
this_master.find(‘input[type="checkbox"]’).each( function () {
var checkbox_this = $(this);
//CREATE VARIABLE OF CHECKBOX_THIS
if( checkbox_this.is(":checked") == false ) {
checkbox_this.prop(‘checked’,true);
//ITS JUST CHECK THE CHECKBOX TO SUBMIT FORM DATA
checkbox_this.attr(‘value’,’0′);
}
})
})
[/javascript]
now I have check the result of form data with print_r($_POST); the above #jQuery function will return checked value =1 and un-checked value return 0
[php]
Array (
[‘checked_checkbox’] = 1
[‘un_checked_checkbox’] = 0
)
[/php]