How my function works:
There are 2 buttons ‘Accept’ and ‘Reject’. When user clicks on Accept, the text will change to ‘Accepted’ and both buttons will be disabled, the same thing with Reject button too. After this process, I need to update the database table column accordingly.
Currently, I was able to update the database according to the button but button text not changed. These are my codes;
<?php
$counter = 1;
$queryst = mysqli_query($conn,"SELECT * FROM applicants WHERE admission_status
= 0 ORDER BY registered_date DESC");
echo '<table class="table table-striped" id="tblData">';
echo "<thead>";
echo "<tr>";
echo "<th>NO</th>";
echo "<th>ID</th>";
echo "<th>NAME</th>";
echo "<th>STATUS</th>";
echo "<tr>";
echo "</thead>";
echo "<tbody>";
while($rowst = mysqli_fetch_assoc($queryst))
{
echo "<tr>";
echo "<td>".$counter. "</td>";
echo "<td>" .$rowst['application_no']."'>".$rowst['application_no']."</a></td>";
echo "<td>" . $rowst['surname'] . " ".$rowst['firstname']. "</td>";
echo "<td>
<a href='appr.php?id=".$rowst['application_no']."'> <input type='button' value='accept'
id='accept' name='accept' class='toggle btn btn-success'> </a></td>";
echo "<td> <a href='disappr.php?id=".$rowst['application_no']."'> <input type='button'
value='Reject' name='reject' class='toggle btn btn-danger'> </a></td>";
echo "</tr>";
$counter++;
echo "</tbody>";
echo "</table>";
?>
The code above is my html code.
This is the php code to accept the candidate with id number.
$getid= $_GET["id"];
$sqla = "UPDATE applicants SET admission_status = 1 WHERE application_no =
'".$getid."' ";
$result = mysqli_query($conn, $sqla);
if($result){
header("location:manage-applicants.php");
}else{
echo "Operation failed";
}
?>
My database was updated but the button was not changed.
I am new to programming, I just want that button text to change value when click and thereafter disable both button.
Please help me