How can I disable submit button on this php script How can I prevent multiple clicks for Add Career button and Remove Career Button
Here is the script
If it's possible, the buttons should be disabled 1 hour for each user.
<?php
// gets current value
if(isset($_POST['output'])){
$value = $_POST['output'];
} else {
$value = 0;
}
if($_POST['Add']){
// opens the file for reading
$read = fopen("file.txt", 'r');
// stores the file as variable cNumAdd
$cNumAdd = fread($read, 512);
// closes file
fclose($read);
// opens file again
$write = fopen("file.txt", "w+");
// adds 1 to the data on the file
$cNumAdd = $cNumAdd + 1;
// writes the data into the file
fwrite($write, $cNumAdd);
// closes file
fclose($write);
}
// comments are the same as above except for subtracting 1 from file
if($_POST['Remove']){
$read = fopen("file.txt", 'r');
$cNumRemove = fread($read, 512);
fclose($read);
$write = fopen("file.txt", "w+");
$cNumRemove = $cNumRemove - 1;
fwrite($write, $cNumRemove);
fclose($write);
}
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="submit" name="Add" value="Add Career">
<input type="submit" name="Remove" value="Remove Career">
<input type="text" name="output" value="<?php include("file.txt"); ?> ">
</form>