I have a table, eventID, remainingTime, serverRestart, autoRestart
When the user clicks submit on my form, it updates the columns to the values I need, but they can continuously click the button and always update the database. I am wanting to disable the submit button after they click it once. I have tried many different options on SOF but nothing works how it should.
What I have tried is the following
$checkForUpdate = "SELECT `remainingTime` FROM `serverrestart` WHERE eventID = 1";
$result = mysqli_query($dbCon, $checkForUpdate);
and my form;
<?
while($row = mysqli_fetch_array($result)){
if(strpos($row['remainingTime']) === false) {
echo "<button class='btn btn-primary' type='submit' name='restart' disabled>Initiate Restart</button>";
} else {
echo "<button class='btn btn-primary' type='submit' name='restart'>Initiate Restart</button>";
}
}
?>
I also used this -> How to disable button based on Database? as a guide also, but the button is always disabled.
So in short.. The user clicks "Initiate Restart" the database fields populate with their values, and the page refreshs, I am wanting the page to refresh but disable the button based on the value in the field ramainingTime
which is always 30