I have 3 different table for each role which is Admin, Mechanic, and User. What I want is to display the table from database for each table (bootstrap table and dataTable) based on selected from dropdown select
Here is my code:
<div class="container hero">
<div class="row">
<div class="col offset-0">
<select>
<optgroup label="Role">
<option value selected>Admin</option>
<option value>Mechanic</option>
<option value>User</option>
</optgroup>
</select>
</div>
</div>
<div class="row">
<div class="col" style="height: 71px;">
<h1 style="font-family: Roboto, sans-serif; font-weight: 300;">Admin</h1>
</div>
<div class="col-md-8 offset-md-2">
<div class="bootstrap_datatables">
<div class="container py-1">
<div class="row py-1">
<div class="col-lg-10 mx-auto">
<div class="card rounded shadow border-0">
<div class="card-body p-3 bg-white rounded">
<div class="table-responsive">
<table id="myTable" style="width:100%" class="table table-striped table-bordered">
<thead>
<tr>
<th>#</th>
<th>ID</th>
<th>Name</th>
<th>Role</th>
<th>View</th>
</tr>
</thead>
<tbody>
<?php
// $sql = "SELECT * FROM admin";
// $result = mysqli_query($connect, $sql);
// if(mysqli_num_rows($result) > 0){
// $i = 1;
// while ($row = mysqli_fetch_assoc($result)) {
// $Name = $row['PERSON_NAME'];
// echo "<tr style='font-size:18px;'>";
// echo "<td class='align-middle'>" . $i; $i++ . "</td>";
// echo "<td class='align-middle'>" . $Name . "</td>";
// echo "<td class='align-middle'></td>";
// echo "<td class='align-middle'></td>";
// echo "<td class='align-middle'></td>";
// echo "</tr>";
// }
// } else {
// echo "<tr>";
// echo "<td colspan='7' class='table-active align-middle'>No Record in Database</td>";
// echo "</tr>";
// }
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
$sql = "SELECT * FROM admin;
$sql = "SELECT * FROM mechanic;
$sql = "SELECT * FROM user;
This is the example of SQL statement where I display data from table admin, mechanic, and user.
So, how can I display table from table Admin in database if admin is selected in dropdown same goes to mechanic and user
Extra request: Boost style of the dropdown select for me if you wish make it look slicker.