RE: [PHP] Multiple SUBMIT Buttons and Default
| From: | Johnson, Kirk | Date: | Thu, 08 Nov 2001 21:54:17 +0000 |
| Subject: | RE: [PHP] Multiple SUBMIT Buttons and Default | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-73959@lists.php.net to get a copy of this message | ||
> On some of my forms I have multiple Submit buttons;
>
> Is there a way to make one of them the *default* button so
> that when a user
> presses their Return / Enter Key, *that default* button will
> be processed?
One way is to give all the buttons the same NAME attribute. Then include a
HIDDEN field just *before* the buttons that has the same name and the same
VALUE that the default button has. The hidden always gets posted, so if no
button gets clicked the hidden provides the value of the default submit. The
hidden has to go before the buttons, so that if the user does click a
button, it overrides the hidden.
Kirk