作者herber (herber)
看板PHP
标题[请益] 按一个按钮传两个变数
时间Wed Feb 27 01:01:59 2008
各位高手大家好
想请教一个问题
希望我的表单能够在按下一个按钮的之後
这个表单可以一次两笔资讯给後端接收资料的 php 网页
所以我这样写
不知道这样的写法到底对不对呢?
<form action = "parser.php" method = "post">
<input type = "image" src = "XXX.jpg">
<input type = "hidden" name = "AAA"> </input>
<input type = "hidden" name = "BBB"> </input>
</input>
</form>
<form action = "parser.php" method = "post">
<input type = "image" src = "YYY.jpg">
<input type = "hidden" name = "AAA"> </input>
<input type = "hidden" name = "CCC"> </input>
</input>
</form>
是这样的
我刚刚试了好一阵子
我发现不论我按下的是第一个 form 里面的按钮
或者第二个的按钮
在 parser.php 里面
isset($_POST['BBB']) 似乎永远都是 true
不知道是不是因为我这样写
在逻辑上有错呢?
谢谢!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.193.18.177
1F:推 chph:没错啊, 你把两个隐藏栏位包在表单里面送出, 那当然是true 02/27 01:08
2F:→ chph:另外原po看哪本书/网站教你input可以这样结尾的? 02/27 01:08
3F:推 cleanwind:因为书说 html 的 tag 都是 <xxx>开始</xxx>结尾 (误) 02/27 01:27
4F:→ starjou:完全没看到 指定 value 的部份呀 02/27 01:47
5F:→ chph:部分元素不是这样的结尾方式喔. <input ... />才是标准方式 02/27 10:44