【发布时间】:2013-07-31 11:10:37
【问题描述】:
我有一个带有多个提交按钮的表单。
每个提交按钮都是一个 IMG SRC 垃圾桶,表示基于 Web 的消息邮件收件箱中消息的删除图标
确定单击了哪个提交按钮图标以便我可以编写 PHP/MySQL 代码来删除消息的最佳方法是什么?
if(!empty($_POST)){
// How do I figure out which submit button has been clicked to get the ID of the message to delete?
}
<form method="POST">
<input src="http://www.foo.com/img.png" id="button_1">
<input src="http://www.foo.com/img.png" id="button_2">
<input src="http://www.foo.com/img.png" id="button_3">
<input src="http://www.foo.com/img.png" id="button_4">
...
<input src="http://www.foo.com/img.png" id="button_100">
</form>
【问题讨论】:
-
哎呀对不起.. 它应该是不要认为它是重复的,该链接用于 2 个提交按钮,我正在寻找适用于 2、5、10 或 1000 的代码......因此,一个序列化的解决方案那么就用同样的技巧一千次……我看不出问题 ;-)