相关关键词
关于我们
最新文章
php批量删除操作(数据访问)

本文实例为大家分享了php批量删除操作的具体代码,供大家参考,具体内容如下
1.批量删除页面 piliangcaozuo.php
<body> <form action="shanchu.php" method="post"> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td><input type="checkbox" name="qx" onclick="quanxuan(this)"/>代号</td> <td>名称</td> </tr> <?php require"DBDA.class1.php"; $db = new DBDA(); $sql = "select * from nation"; $arr = $db->query($sql); foreach($arr as $v) { echo "<tr> <td><input type='checkbox' name='ck[]' class='ck' value='{$v[0]}'/>{$v[0]}</td> <td>{$v[1]}</td> </tr>"; } ?> </table> <input type="submit" value="批量删除" /> </form> </body> <script type="text/javascript"> function quanxuan(qx) { var ck=document.getElementsByClassName("ck"); if(qx.checked) { for(var i=0;i<ck.length;i++) { ck[i].setAttribute("checked","checked"); } } else { for(var i=0;i<ck.length;i++) { ck[i].removeAttribute("checked"); } } } </script> </html>