Re: Re[2]: [PHP] Re: Form Submission
| From: | Curt Zirzow | Date: | Tue, 06 Jul 2004 22:11:59 +0000 |
| Subject: | Re: Re[2]: [PHP] Re: Form Submission | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189826@lists.php.net to get a copy of this message | ||
* Thus wrote Torsten Roehr:
> > >
> > > How do you check which button was pressed (read: which action should be
> > > performed) when not relying on this?
> > >
> >
> > The button is generally *not* sent by the browser if you hit enter
> > instead of submit. This *will* happen, so you have to deal with it.
> >
> > If you want to knwo what button was pressed, you have to have
> > different button names or values and check them. A button is just
> > another form element that is submitted.
>
> I believe you are wrong here. I just checked it in IE5 and Opera 7.23.
> Submitting a form by hitting enter IS THE SAME as pressing a submit button
no, it is simply unpredictable to what will happen, my test case...
Site: google.com
Browsers: IE6, Opera, Firefox, netscape4
Test: Enter 'asdf' and hit enter.
Results:
Opera and firefox sent in the url &btnG=Search, signifying that
the first button has been submited.
IE6 and netscape4, don't have that parameter in the url.
In fact, google *had* code that checked for the btnG value and if it
exsited it would display a tip about being able to simply hit
enter. They no longer do that since it is unreliable.
>
> So from my point of view a form cannot be submitted without at least one of
> the submit button values ending in POST.
And if it did, which one does it send? If there are multiple
buttons on a page, does it send the one closest to the focused
item? or does it send the very first one it finds no matter how the
page is visually layed out?
>
> What do you think?
Never rely on button values to decide on a course of action.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!