Home > Bugs > The Submit Button Problem

The Submit Button Problem

The problem is coupled with the use of the HTML 4.0 tag <button></button>. This tag was designed to extend the usage of the <input type="submit"/> and give you the ability to make any peice of HTML a “button” by placing its contents within a “button” container (between the tags). You can create image buttons, colored text buttons, or a myriad of other things. Hence, the following peice of HTML would serve as a fine “add” button for our “Add Collections” dialog.

<button type="submit" name="action" value="addCollection">Add</button>

This is where IE deviates from the HTML specification. Below is the URL produced by Firefox and the URL produced by IE upon clicking the submit button.

IE: plog-manage.php?action=Add&name=...
Firefox: plog-manage.php?action=addCollection&name=...

As you can see, Internet Explorer passes the text “Add” as the value of “action”. Firefox does the proper thing and sends the value placed in the “value” attribute, whereas IE sends the content inserted between the button tags. As a result, the PHP code which checked the value of action from the $_REQUEST array had a value it didn’t know what to do with, “Add”.

So the solution turned out to be pretty simple, reverting the code back to the tried and true <input type="submit" name="something" value="somethingelse".../> tag. Both browsers reliably send the “value” attribute when building a POST or GET URL encoded string from an input tag.

Categories: Bugs
  1. August 24, 2007 at 6:51 am | #1

    I have visited your site 164-times

  2. September 4, 2007 at 4:52 pm | #2

    I have visited your site 591-times

  3. November 2, 2008 at 5:55 am | #3

    Very interesting blog. Are you interested in my ratty removal Oh, good joke) What do you call a crazy blackbird? A raven lunatic!

  1. No trackbacks yet.