<form name="del_form" action="del.php" method="post">
<?php
$result=mysql_query("select * from news");
while($rs=mysql_fetch_array($result)){
?>
<input name="del_id[]" type="checkbox" id="del_id[]" value="<?=$rs[id]?>" /><?=$rs[title]?>
<?php
}
?>
</form>
2、处理页面(del.php):
<?php
if($del_id!=""){
$del_num=count($del_id);
for($i=0;$i<$del_num;$i++){
mysql_query("Delete from news where id='$del_id[$i]'");
}
echo("<script type='text/javascript'>alert('删除成功!');history.back();</script>");
}else{
echo("<script type='text/javascript'>alert('请先选择项目!');history.back();</script>");
}
?>
我想知道from是如何将参数传入到处理页面然后再进行数据库操作的,希望大家帮忙解答,谢谢!
<?php
$result=mysql_query("select * from news");
while($rs=mysql_fetch_array($result)){
?>
<input name="del_id[]" type="checkbox" id="del_id[]" value="<?=$rs[id]?>" /><?=$rs[title]?>
<?php
}
?>
</form>
2、处理页面(del.php):
<?php
if($del_id!=""){
$del_num=count($del_id);
for($i=0;$i<$del_num;$i++){
mysql_query("Delete from news where id='$del_id[$i]'");
}
echo("<script type='text/javascript'>alert('删除成功!');history.back();</script>");
}else{
echo("<script type='text/javascript'>alert('请先选择项目!');history.back();</script>");
}
?>
我想知道from是如何将参数传入到处理页面然后再进行数据库操作的,希望大家帮忙解答,谢谢!
post传递参数
id后面的内容,你想查询什么就跟什么
如登录的时间,用户和密码的验证
select * from table where user=$_POST['user'] and password=$_POST['password'];
mysql_query("Delete from news where id='$del_id[$i]'");
我说的是我的这段当中的ID的值是怎么传过来的- -