<?php
/**
* Created by PhpStorm.
* User: hasee
* Date: 2015/6/24
* Time: 18:40
*/
include("conn.php");
$arr=mysql_query("select * from new",$conn);
while($result=mysql_fetch_assoc($arr)){
?>
<tr>
<td height="25"><?php echo $result['title']; ?></td>
<br>
<td height="25"><?php echo $result['content']; ?></td>
<td><label>
<input type="hidden" name="id" value="<?php echo $result['id']; ?>">
<div align="center">
<a href="update.php?id=<?php echo $result['id']; ?>">编辑</a>
<a href="delete.php?id=<?php echo $result['id']; ?>">删除</a>
</div>
</label>
</td>
</tr>
<?php
}
mysql_close($conn);
?>
<form id="form1" name="form1" method="post" action="index_ok.php" >
<?php
include("conn.php");
$arr=mysql_query("select * from new where id='".$_POST['id']."'",$conn);
$select=mysql_fetch_array($arr);
?>
<input type="submit" name="submit" value="删除" />
<input type="hidden" name="id" value="<?php echo $select['id']; ?>">
</form>
onepeople 发表于 2015-6-25 13:30
为啥删除不能够$_POST['id']而编辑可以呢?这个是我删除的文件
以上这句中文,我都看不懂.. ...
hising 发表于 2015-6-25 13:28
我也是小白。没学过php我感觉是下面的问题
$arr=mysql_query("select * from new where id='".$_POST['id' ...
。另外,如果能谷歌一下,很容易搞定。三叶草 发表于 2015-6-25 13:48
因为你用的URL传值是GET方式,应该用$_GET['id']。你编辑的时候应该$_POST也取不到值,这个和PHP的关系好像 ...
| 欢迎光临 全球主机交流论坛 (https://fd.vvwvv.eu.org/) | Powered by Discuz! X3.4 |