[thelist] MSIE Form Submit Issues Discovery

Michael Barrett mbarrett at abouthalf.com
Wed Feb 19 17:05:01 CST 2003


This may be old news to many...

I was working on a little search tool for a PHP site. My layout
includes a little baby search form in the navigation, the search
results page has the search form repeated for easy re-searching.

In MSIE,  completing the search form, and hitting the enter key (not
clicking "submit") was returning a blank form, as if no search terms
had been entered. This happened from either search form.

At first I thought IE was confused about what form to submit, so I
re-named all the fields and checked for them in my search script.

Still getting  a blank page.

Then I thought that IE was just not submitting the form properly and
maybe I needed some Javascript to submit the form on  "enter"

Realizing that this was going nowhere I had my search script spit out
all the post variables. Bingo.

Submitting a form with the enter key in IE does not post the name/value
of the submit button in the form.

My PHP script was using the name and value of the submit buttons to
check for form submission. Since IE chose not to include those in the
form submission, I was getting an empty search each time. D'oh!

<tip type="POST variables in MSIE" author="Michael Barrett">
MSIE will not include the name and value for submit buttons from posted
forms if the form was posted by typing "Enter" and not clicking the
Submit Button.

This can cause problems in your applications if your script relies on
those button values.
</tip>




More information about the thelist mailing list