|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Disabled submit button prevents form submission
I have a web form that submits to itself--a guestbook, for example. I have tried all the usual JavaScript techniques for disabling the Submit button (to prevent inadvertant multiple submissions), but they also prevent proper functioning of the page.
The PHP code in the page that tests whether the form has been submitted is if (isset($_POST['submit']) && $_POST['submit'] == 'Add guestbook entry') { // Error-check, then insert entry into database rather than displaying the form again } But this condition always fails, and I'm wondering why. Is it because the submit button has been disabled? Can anyone help? |
|
#2
|
|||
|
|||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST')
is the conditional that should be used. Problem solved, and thanks to John Holmes. (Hope this helps somebody else in the future.) |
|
#3
|
||||
|
||||
|
If i remember correctly, the submit button data is only passed if you click the submit button with your mouse (or trigger the button in general)...
If you press enter from any other field (a textbox for example) in the form than the submit information isn't sent... Assuming i'm right (i haven't tested this in on current browsers), than I'd suggest perhaps a hidden field containing any information you want (just to validate). |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Disabled submit button prevents form submission |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|