js函数:

HTML页面调用:

    

   

   
   
   

PHP处理页面:

$rdd = trim($_GET['rd']);

//全选删除
if(!empty($rdd) && $del = "allDel"){
 $arr_id = explode(",",$rdd);  //explode函数是把字符串分裂为一个数组
 foreach($arr_id as $key=>$val){  //不确定是单选还是多选,这里使用一个foreach循环
     $delete = $dbh->exec ( "DELETE FROM mistake WHERE mistakeId = '$val'" );
 }
 $reback = '0';
 if($delete){
     $reback = '1';
 }else{
     $reback = '2';
 }
 echo $reback;
}

// 独立删除

if(!empty($id) && $del = "oneDel"){
 $sub = $dbh->exec ( "DELETE FROM mistake WHERE mistakeId = '$id'" );
 $reback2 = '0';
 if($sub){
     $reback2 = '1';
 }else{
     $reback2 = '2';
 }
 echo $reback2;
}