Jump to content

Disable buttons in form


livewirerules

Recommended Posts

I have a html form with a Submit and Reset buttons, Each time the user clicks on it the click count will be incremented and stored in a database.

I want to know how to disable the buttons/gray out the buttons in the html form when the user has reached a certain amount of clicks stored in the DB, so that the user cannot continue anymore.

 

 

Any help will be appreciated :)

Link to comment
https://forums.phpfreaks.com/topic/116205-disable-buttons-in-form/
Share on other sites

you would query the database first to get the number of clicks then just use a simple if statement.

 

<?php
$disabled = $r['tablefield'] > 1 ? "disabled=\"disabled\"" : "";
echo "<input type=\"submi\"t name=\"submit\" value=\"submit\" $disabled />\n";
?>

 

Ray

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.