Using PHP, how can I get the element holding the visit ID from the corresponding row in the HTML table?
I have an HTML table that fills its data from a table in the database, there's an approve button for the admin to approve the visit and change its status to APPROVED, I need to know how I can be able to select element holding the ID, so I can query on the visits and edit its 'STATUS' attribute
Here's the code inserting the table:
<table class="table table-bordered table-striped">
<thead>
<tr>
<th scope="col">Request Num</th>
<th scope="col">Visitor Name</th>
<th scope="col">Car Number</th>
<th scope="col">Visit Date</th>
<th scope="col">Status</th>
<th scope="col">Approve</th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['sess_flag'] == 1) {
$getVisits = $connection->prepare("SELECT * FROM Visit");
$getVisits->execute();
$visits = $getVisits->fetchAll();
foreach ($visits as $visit) {
echo " <tr>
<th scope='row' class='id'>". $visit['VISIT_ID'] ."</th>
<td>". $visit['VISITOR_NAME'] ."</td>
<td>". $visit['CAR_PLATE_NUMBER'] ."</td>
<td>". $visit['VISIT_DATE'] ."</td>
<td>". $visit['STATUS'] ."</td>
<td>
<div class='icon-container'>
<i class='far fa-check-square icon'></i>
</div>
</td>
</tr>";
}
}
?>
</tbody>
</table>
source https://stackoverflow.com/questions/68975749/using-php-how-can-i-get-the-element-holding-the-visit-id-from-the-corresponding
Comments
Post a Comment