| Article: |
PHP Form Handling | |
| Subject: | Form submission with hidden element | |
| Date: | 2004-11-15 21:58:56 | |
| From: | az_pete | |
|
You mentioned: testing for the presence of a hidden element avoids problems that can result from browsers' varying behaviors when a user submits a form by pressing the Enter key instead of clicking a submit button. Could you elaborate on the problems that result when a user presses the enter key versus clicking the submit button? I have generally just tested for the value of the submit button within my scripts instead of having to manage another form element (e.g. if (isset($_POST['submit_button_value'])) {process form} ). Is this not as good a method? Any thoughts would be appreciated. Thanks. |
||
Showing messages 1 through 2 of 2.
-
Form submission with hidden element
2006-01-03 20:44:16 Gustavoang [View]
-
Form submission with hidden element
2008-08-07 11:27:30 DeputyDawg [View]
Some browsers only transmit the name/value pair for the submit form element when the submit button is clicked. If the form is submitted with the 'Enter' key, then the name/value pair for the submit element is not sent (method POST or GET). All the other form element name/value pairs appear to be sent, including hidden elements.
Only some browsers act this way. I believe IE 7.0 is one.
Therefore you cannot use the name/value pair for the submit button as a reliable test for the form being submitted. Hidden elements do show up.
I have experienced this problem with PHP5, but not with PHP4. Cannot explain that one.



I think It isn't a good method at all.
--
Gustavo Narea.