只需一步,快速开始
<?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的关系好像 ...
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|全球主机交流论坛
GMT+8, 2025-11-5 04:29 , Processed in 0.077928 second(s), 10 queries , Gzip On, MemCache On.
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.