php如何对表单数据进行批量修改?
//表单 <form> ............ <input name="Key[]" type="text" id="Key[]" value="<?php echo $rs->Fields(Key)->value;?>" size="5"> <input name="del_id[]" type="text" id="del_id[]" value="<?php echo $rs->Fields(id)->value;?>" size="5"> ............ </form>
<? $action=$_POST['action']; if($action=='del'){ $rs=new COM("adodb.recordset"); for($i = 0; $i < count($_POST[Key]); $i ++){ $rs->open("UPDATE [Products] SET Key = ".$_POST[Key][$i]." where id = ".$_POST[del_id][$i]."",$conn,1,1); } echo "<script type='text/javascript'>alert('处理成功!');window.location.href='Productstj_Manage.php';</script>"; } ?>
|