PHP批量删除做法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; " />
<title>无标题文档</title>
</head>
<body>
<form action="shanchu.php" method="post">
<table> <tr>
<td><input type="checkbox" />全选</td>
<td>代号</td>
<td>名称</td>
</tr>
<?php
include("../toupiao/PPO.class.php");
$db = new PPO();
$sql = "select * from nation";
$attr = $db->Query($sql);
foreach($attr as $v)
{
echo "<tr>
<td><input type='checkbox' name='ck[]'> <td>{$v}</td>
<td>{$v}</td>
</tr>";
}
?>
</table>
<input type="submit" value="删除" />
</form>
</body>
<script type="text/javascript">
function xuanzhong()
{
//取全选按钮的选中状态
var zt = document.getElementById("qx").checked;
//让下面所有的checkbox选中状态改变
var ck = document.getElementsByClassName("ck");
for(var i=0;i<ck.length;i++)
{
if(zt)
{
ck.setAttribute("checked","checked");
}
else
{
ck.removeAttribute("checked");
}
}
}
function tishi()
{
//找所有选中项
var ck = document.getElementsByClassName("ck");
var str = "";
for(var i=0;i<ck.length;i++)
{
if(ck.checked)
{
str += ck.value+",";
}
}
return confirm("确定要删除以下数据么:"+str+"");
}
</script>
</html>
页:
[1]