用一个数组,比如 checkbox,
然后用PHP生成如下html
<input type=checkbox name=checkbox[] value="此处填上数据记录的主键">
然后在action页面里会得到checkbox数组,做一下遍历,然后删除相应的id...foreach ($checkbox as $v)
{
     $sql = "delete from tb_name where key='$v'";
     mysql_query($sql);
}

解决方案 »

  1.   

    1,读数据,
    $res=mysql_query("select * from xxx where xxxx order by xxx desc limit xxx");
    while($r=mysql_fetch_array($res)){
      echo $r["xxx"]."<input type=\"checkbox\" onClick=\"window.open('del.php?id=xx','','width=100,height=100');\"><br>\n";
    }2,删数据 del.php
    <?php
    $id=$_GET["id"];
    $res=mysql_query("delete from xxx where id='$id'");
    ?>
    <script>
    window.opener.location.reload();
    window.close();
    </script>
      

  2.   

    把数据库里的记录输出来用一个循环就行了.
    致于每一行的复选就要用到数组的.
    比如你把复选框定义为checkbox[]
    然后在处理删除的语句中用implode(",",$checkbox[])
    来把每一行的记录取出来就可以了!
      

  3.   

    用复选框的目的应该是批量的删除吧。核心语句就一条$sql = "delete from tb_name where id in (1,2,3,4,5,6,……)";至于那一串数字如何得到,上面的都讲完了。