Home  >  Article  >  Backend Development  >  循环输出时可能id值

循环输出时可能id值

WBOY
WBOYOriginal
2016-06-13 12:58:25867browse

循环输出时或许id值

正在做一个的管理员页面,这个是foreach输出的内容,怎样让每一条留言都有自己的id 点击后在后台删除 怎样传输id值  我应该怎么写代码?
------解决方案--------------------
楼主是如何提交表单的?楼主的表单时每个留言一个表单还是所有留言一个表单?每个留言一个表单在表单里加个隐藏域,内容是该留言ID就可以了,如果是所有一个表单,那么在修改按钮那增加CLICK事件,点击事件函数的参数就是ID号,自己组织JS代码提交。
------解决方案--------------------

引用:
引用:spshanchu.php中
echo $_GET['id'];
看下能输出相应的ID不 如果可以 我想你也知道要怎么做了吧!
有个东西叫做short open tag

谢谢!
------解决方案--------------------
按钮事件 onclick=window.location="index.php?action=update&id={$id}"
------解决方案--------------------
先理解静态的吧。
index.html           中:
放到<script></script>中: function myDelete(id){ location.href="spshanchu.php?id="+id; }
spshanchu.php        中: 
运行index.html 点按钮, 试着修改代码看能理解不。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn