Form - clicking submit vs. hitting enter
Posted: Wed Sep 26, 2007 6:19 am
I have a php form as follows:
with some form elements
and a submit button:
I have php code to do some work on the submit:
If I click submit, all is well, but if I hit the return key with a form element in focus, the page just reloads. Putting an else statement on the if above, the "if" is executed on clicking submit and the "else" is triggered when I press the return key.
So what is happening when I hit the return key with a form element in focus, and what other condition can I check to get the code in the if statement to run?
Thanks.
Code: Select all
<form style="width: 345px" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="domain" name="domainform">and a submit button:
Code: Select all
<input class="text" type="submit" name="submitBtn" value="Check domain"/>Code: Select all
if (isset($_POST['submitBtn'])){So what is happening when I hit the return key with a form element in focus, and what other condition can I check to get the code in the if statement to run?
Thanks.