开发者

Alternative to name attribute on image input in HTML5

HTML5 does not $_POST the 'name' attribute for image inputs.

I am trying to find an alternative so that my server-side validation checks can identify 开发者_开发问答which submit button in the form has been clicked on. Can anyone offer suggestions.


It does post the name attribute but it posts as two variables, appending _x and _y to the name. So this example:

<form action="collect.php" method="post">
  <label>Image button 1: <input type="image" src="Calvin5.gif" alt="calvin5" name="calvin5"></label><br>
  <label>Image button 2: <input type="image" src="Calvin6.gif" alt="calvin6" name="calvin6"></label><br>
</form>

Will, when you click on the first button, result in values something like:

calvin5_x : 33
calvin5_y : 54 

In your $POST array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜