1. Forms Submit Data <form action= "__url__/deleteselected" method= "POST" ></form>2.js validation <a href= "#" onclick= "Delall ()" class= "delete" > bulk delete </a><td class= "TC" > <input name= "id[]" value= "<{$voList .txt_id}>" type= "checkbox" ></td><script > function delall () { var chk_value =[]; $ (' input[name= ' id[] "]:checked '). each (function () { chk_value.push ($ (this). Val ()); console.log (chk_value); var submit = confirm (chk_value.length==0 ? ') You have not selected any content yet! ': ' Do you need to remove ' id ' +chk_value+ '); if (Submit) { window.location.href = "__url__/deleteselected/id/" +chk_value; return false; } else{ return false; }; } </script> 3. Delete //Bulk Delete public function deleteselected () { $getid = $_request[' id ']; //gets the value of the selected check box dump ($getid); if (! $getid) $this->error (' record not selected '); //no option to prompt information $getids = implode (', ', $getid); //choose more than one, It is used to connect the values ( = is_array) $id ($getid) $getids : $getid, //if it is an array, it will be used, connected value to the $id, otherwise it will not be obtained, the number of concatenated values //the last data operation, $Result = d ("Txt")->delete ($id); $say = ' delete Success '; if ($Result === false) { $this Error (' operation failed '); } else { $this->success ($say); } }
thinkphp Bulk Delete