Another IE bug?

Mozilla Firefox versus Microsoft Internet Explorer
Dec
3

Today, thanks to an article I read via dzone I found that the button tag is treated differently in IE to other browsers when given a name tag so it can be read via the POST or GET result. In IE (both in 7 and older versions) the value of the variable will be the innerHTML of the button, but in Firefox (and Opera, etc.) the value is the what's assigned to the value tag. Yet another thing for Microsoft to fix.

IE5.5/Win
Submits value from innerHTML
IE6/Win
Submits value from innerHTML
Firefox/Win
Submits value from tag
Firefox/Mac
Submits value from tag
IE/Mac
Doesn't submit any value - button tags do not get included in form submission even when they have a name attribute
Opera
Submits value from tag
Safari
Submits value from tag

To see for yourselves, try this:

<?php
   print_r($_POST);
?>
<form action="<?php print $_SERVER['PHP_SELF']; ?>"
      method="post">
   <input type="text" name="testfield" value="" />
   <button name="testbutton" type="submit"
      value="Value Attribute">Inner HTML value</button>
</form>

Source: Random Thoughts

your comments - Post a comment

Todd

This is a well known issue with IE. (and is still broken in IE7)

See here for more details, and related bugs.
http://webbugtrack.blogspot.com/2007/10/bug-341-button-element-submits-wrong.html

Todd commented 4 years ago
blog comments powered by Disqus