Submit buttons not submitting
Wow, I have been busy lately, what with a hectic workplace and personal life. But I am here to tell you about a little problem I have known about for years but recently popped up when a friend couldn’t work out what was happening.
The problem essentially arrises with bad programming practices, checking to see if the submit button is set (isset()) before allowing the form to be processed. If you press the ‘Enter’ key whilst in one of the inputs then Internet Explorer does, and will not, send the submit button along with the HTTP header request. Strange, huh?
I haven’t quite worked out why they would do this, I can only assume it is a bug on their behalf from their legacy spaghetty code.
So, how can I avoid this?
Quite simply really. Checking to see if the form button exists is, essentially, a bad programming practice in my opinion—after all, the submit button does not (or rather, should not) contain any information essential to the forms processing. This is how I would, and do, check that a form has been submitted:
- <?php
- if ($_SERVER['REQUEST_METHOD'] == 'POST')
- {
- ...
That’s it. Of course, this only works for POST requests since GET requests are every other type of request (See my other note POST requests are actually GETs), but GET’s should contain some kind of action keyword anyways.

1 Paul wrote
9th August, 2007
Yup, that is actually how I do mine as well. When I need a bit more control over which form has been submitted, in the case of multiple forms on a page, then I will use a unique querystring value.