Html
<form method= "POST" action= "{: U (' Home/qrcode/alldel ')}" Name= "Form1" Id= "Form1" onsubmit= "return confirm (' Are you sure you want to delete all? ‘);" >
<input type= "checkbox" class= "Ng-pristine ng-valid" value= "{$vo. ID}" name= "check[]" ></td>
<input type= "checkbox" class= "Ng-pristine ng-valid" onclick= "Checkall (' All ')" >//Click to select
<button type= "Submit" class= "btn btn-default ng-binding" > Bulk Delete </button>
</form>
Php
Public Function Alldel () {
$check =array ();
$check =i ("Post.check");
if ($check = = "") {
$this->error ("Please select the information to be deleted");
}else{
$str =implode (', ', $check);
$r =m ("QRCode")->where (Array (' ID ' =>array (' in ', $str)))->delete ();
if ($r) {
$this->success ("Delete succeeded! ", __app__." /home/qrcode/index ", 2);
}else{
$this->error ("Delete failed! ", __app__." /home/qrcode/index ");
}
}
}
Js
<script type= "Text/javascript" >
function Checkall (t) {
var es = document.form1.elements;
for (Var i=0;i<es.length;i++) {
if (Es[i].type = = ' checkbox ') {
if (t = = ' all ') {
es[i].checked =!es[i].checked;
}
}
}
}
</script>
Php+html+js Select All Delete