变量传递
[ATTACH]1553[/ATTACH]如图:点击[b]删除[/b]后,能把这段记录删除掉.下面是显示这个的那段代码.我不知道怎么把这些参数传递到./delete.php里面.
请大家多多指点,多多帮助.谢谢
[PHP]<form name="form1" method="post" action="">
<table width="100%" border="0">
<?php do { ?>
<tr>
<td height="52"><?php echo $row_accountinformation['deviceID']; ?></td>
<td height="52"><?php echo $row_accountinformation['idc']; ?></td>
<td height="52"><?php echo $row_accountinformation['ip']; ?></td>
<td height="52"><?php echo $row_accountinformation['account']; ?> <span class="style11"><?php echo $row_accountinformation['type']; ?></span> </td>
<td height="52"><a href='./delete.php'>删除</a></td>
<td height="52"><?php echo $row_accountinformation['time']; ?></td>
<td height="52"><?php echo $row_accountinformation['day']; ?></td>
</tr>
<?php } while ($row_accountinformation = mysql_fetch_assoc($accountinformation)); ?>
</table>
</form>[/PHP]
回复: 变量传递
<form name="form1" method="post" action="">在action中加action="./delete.php"这样就可以把表单里的信息传递到delete.php中。
delete.php中用$_POST[]获取你要的信息就成了
回复: 变量传递
如果是上传文件,要加配型回复: 变量传递
<form name="form1" method="post" action="delete.php"><table width="100%" border="0">
<?php do { ?>
<tr>
<td height="52"><input type="checkbox" name="id[]" value="<?php echo $row_accountinformation['deviceID']; ?>" checked /></td>
<td height="52"><?php echo $row_accountinformation['idc']; ?></td>
<td height="52"><?php echo $row_accountinformation['ip']; ?></td>
<td height="52"><?php echo $row_accountinformation['account']; ?> <span class="style11"><?php echo $row_accountinformation['type']; ?></span> </td>
<td height="52"><a href='delete.php?id=<?php echo $row_accountinformation['deviceID']; ?></删除</a></td>
<td height="52"><?php echo $row_accountinformation['time']; ?></td>
<td height="52"><?php echo $row_accountinformation['day']; ?></td>
</tr>
<?php } while ($row_accountinformation = mysql_fetch_assoc($accountinformation)); ?>
</table>
</form>
/////////////////////delete.php
<?php
//========== delete.php ================//
($id != "") ? $id = $_POST['id'] : $id = $_GET['id'];
if($id != ""){
if(is_array($id)) {
$id = implode("','",$id);
$id = " IN('".$id."')";
}else {
$id = "='".$id."'";
}
}
$deltextsql = "DELETE FROM 数据表名 WHERE 表ID ".$id; ///所用到的SQL语句
回复: 变量传递
学习中,页:
[1]