permanetly disable submit button

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tinoda
Forum Commoner
Posts: 33
Joined: Mon Dec 29, 2008 3:32 am

permanetly disable submit button

Post 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
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: permanetly disable submit button

Post 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 -->
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: permanetly disable submit button

Post by pickle »

If it's permanent, why even have the submit button in there at all?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: permanetly disable submit button

Post 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
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: permanetly disable submit button

Post 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...
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: permanetly disable submit button

Post 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.
Post Reply