deleteall.php 501 B

1234567891011121314151617
  1. <?php
  2. header("Content-type:text/html;charset=UTF-8");
  3. include_once("../untils/conn.php");
  4. if (count($_POST["chk"]) <= 0) {
  5. echo "<script>alert('请选择记录');history.go(-1);</script>";
  6. } else {
  7. for ($i = 0; $i < count($_POST["chk"]); $i++) {
  8. //for语句循环读取复选框提交的值,
  9. $sql = "delete from list where id=" . $_POST["chk"][$i];
  10. mysqli_query($con, $sql);
  11. }
  12. echo "<script>alert('删除成功');location.href='../list.php';</script>";
  13. }