通过选中复选框删除多行


Deleting multiple rows by selecting the check boxes

我是php的新手。我想通过选中复选框来删除多行,但在我的代码中,只有当所有复选框都选中时,它才是删除。如果我从中选择一个,它就是nit删除。。。有人能帮我解决这个吗

var is_activate = true; // we will track which input button was clicked :)
jQuery(function($) {
$("#form input#check_all").change(function() {
var inputs  = $("#form input[type='checkbox']");
  if ( $(this).is(":checked") ) {
    inputs.prop( "checked", true );
    // inputs.attr( "checked", true ); // if its not working
  }
  else {
    inputs.removeAttr( "checked" );
  }
});
// Track clicked button
$("#form input[type=submit]").on("click",function(e) {
  is_activate = ( $(this).hasClass("activate_btn") ) ? true : false;
});
$("#form").submit(function(e) {
  e.preventDefault();
  var string  = ( is_activate ) ? 'activate' : 'delete';
  var data    = $(this).serialize();

  var checked = $(this).find("input[name='data[]']:checked").length;
  if ( checked == 0 ) {
    alert( "Please select a record(s) to "+string+"." );
    return false;
  }
  var text  = "Are you sure you want to "+string+" these Notices"+( ( checked == 1 ) ? "?" : "s?" );
  if ( confirm( text ) ) {
    $.ajax({
      url: 'resources/ajax/'+( ( is_activate ) ? 'ajax_activate_comment.php' : 'noticeView.php?delete=$w' ),
      type: 'post',
      data: data,
      success: function( data ) {
      }
    });
  }
});

});

我的复选框

echo "<input name='data[]' type='checkbox' id='data' value=''/> ";
php 中的

$data = $_POST['data'];
foreach($data as $d)
{
  //delete query by $d as id
}