Page 1 of 1

permanetly disable submit button

Posted: Tue Jan 06, 2009 1:54 pm
by tinoda
how do i permanently disable a submit button in php so that even if the user refreshes the page it will remain disabled

Re: permanetly disable submit button

Posted: Tue Jan 06, 2009 2:21 pm
by jaoudestudios
if you want to disable a submit button you dont need php just use disabled in html.
i.e.

Code: Select all

<input type='submit' disabled='disabled' value='submit' name='submit' id='submit' /> <!-- W3C strict -->

Re: permanetly disable submit button

Posted: Tue Jan 06, 2009 4:37 pm
by pickle
If it's permanent, why even have the submit button in there at all?

Re: permanetly disable submit button

Posted: Tue Jan 06, 2009 4:46 pm
by Eran
To mock them stupid users trying angrily to click on the button! :twisted:

Seriously though, reading into his question he probably disables the button in javascript but somehow wishes to persist that state through PHP (via AJAX maybe?)
Didn't give enough detail

Re: permanetly disable submit button

Posted: Wed Jan 07, 2009 3:27 am
by mattpointblank
Be careful with this though - if the form's never meant to be submitted, don't add a button, even one disabled like people have suggested. Tools like the Firefox Web Developer toolbar can enable disabled buttons...

Re: permanetly disable submit button

Posted: Wed Jan 07, 2009 6:06 am
by jaoudestudios
I think he means after the form has been submitted, to disable the button. To do it that way, you would have to set a session variable, so if the user returns to that page they can not resend the form - this is not full proof as they can clear their browser cache and resent the form.