1、checkbox, 复选框
注意全选的JS:
每个checkbox:
获取传入的value=$id, 并以逗号进行分割:
$each = implode(",", $_POST["each"]);
|
2、textarea
<form name="add" action="submit_add.php" method="post">
<textarea name="iplist" rows="20" cols="80"></textarea><br />
|
分割
$iplist = str_replace("\r\n", ",", $_POST["iplist"]);
$ip = explode(",", $iplist);
|
针对每行做处理,写数据库,这里只处理了第一列ip。
for ($i = 0; $i <count($ip); $i++)
{
$b_ip = explode(" ", $ip[$i]);
$sql_select = "insert into filter (owner, ip, reason) values('$owner', '$b_ip[0]', '$reason');";
mysql_query($sql_select) or die("Invalid query: " . mysql_error());
$sql_select = "update filter set expire_real_time=(select date_add(curdate(), interval 60 day)) where ip='$b_ip[0]';";
mysql_query($sql_select) or die("Invalid query: " . mysql_error());
echo "$b_ip[0] add success ";
}
|
阅读(1214) | 评论(0) | 转发(0) |