Re: Form won't submit when pressing enter key
| From: | Michael Sims | Date: | Thu, 16 Jan 2003 01:41:34 +0000 |
| Subject: | Re: Form won't submit when pressing enter key | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131794@lists.php.net to get a copy of this message | ||
On Wed, 15 Jan 2003 17:23:26 -0800, you wrote:
>I have a form created by this code (I don't know if it's important):
>
>if ($_POST["submit"]) {
[...]
>After you fill out the only field, you HAVE to click the submit button to
>submit the form. If you press enter to submit the form it reloads the form
[...]
When you submit a form by pressing enter, the value of the submit
button is not sent in the POST data. This is not a problem though,
just replace:
if ($_POST["submit"]) {
with:
if (!empty($_POST)) {
Which basically says process the form if the $_POST superglobal has
any elements in it whatsoever.