本文介绍了如何将按钮值发布到PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在一个html页面上使用AZ按钮,如下图所示(仅适用于样本和几个字)
更改键入到提交并给它一个名称(并删除无用的 onclick 并将90年代风格的大写标签/属性展平)。
< input type =submitname =foovalue =A/>
< input type =submitname =foovalue =B/>
...
该值可由 $ _ POST ['foo'] (如果父母< form> 有一个 method =post)。
I want use A-Z buttons on a html page like shown below (only sample and few words)
<INPUT TYPE="BUTTON" VALUE=" A " ONCLICK="A"> <INPUT TYPE="BUTTON" VALUE=" B " ONCLICK="B"> <INPUT TYPE="BUTTON" VALUE=" C " ONCLICK="C"> <INPUT TYPE="BUTTON" VALUE=" D " ONCLICK="D"> <INPUT TYPE="BUTTON" VALUE=" E " ONCLICK="E"> <INPUT TYPE="BUTTON" VALUE=" F " ONCLICK="F"> <INPUT TYPE="BUTTON" VALUE=" G " ONCLICK="G"> <INPUT TYPE="BUTTON" VALUE=" H " ONCLICK="H"> <INPUT TYPE="BUTTON" VALUE=" I " ONCLICK="I"> <INPUT TYPE="BUTTON" VALUE=" J " ONCLICK="J">when I click on each button I want to post respective values on button to a PHP variable.
How can I do this?
解决方案Change the type to submit and give it a name (and remove the useless onclick and flat out the 90's style uppercased tags/attributes).
<input type="submit" name="foo" value="A" /> <input type="submit" name="foo" value="B" /> ...The value will be available by $_POST['foo'] (if the parent <form> has a method="post").
这篇关于如何将按钮值发布到PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!