Put your checkboxes in the <form> and name your checkboxes using PHP array notation:
<form id="form1"> <input type="checkbox" name="item[]" value="1"> <input type="checkbox" name="item[]" value="2"> <input type="checkbox" name="item[]" value="3"> </form>
Using jQuery.serialize() :
$(function () { $('.btnadd').click(function () { $.ajax({ url: 'process.php', type: 'post', data: $.serialize("#form1"), success: function (data) {} }); }); });
On the server side, $_POST["item"] will have an array containing only verified values.
source share