I've made a table with some employees and I'm using modals for Add new / Details / Edit / Delete.
I don't know how to open the details modal for specific users... [USING BOOTSTRAP 5].
This is the button:
<td method="MODAL"><button type="button" class="btn btn-sm btn-block btn-info" data-id="<?php echo $employee['e_id']; ?>" data-toggle="modal" data-target="#designerDetails">Details</button></td>
And here is the modal:
<div class="modal fade" id="designerDetails" data-e-id="<?php echo $employee['e_id']; ?>" tabindex="-1" aria-labelledby="designerDetails" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Designer details</h5>
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table">
<?php
$sql = "SELECT * FROM employees";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($employee = mysqli_fetch_assoc($result)) { ?>
<tr>
<th>ID</th>
<td><?php echo $employee['e_id']; ?></td>
</tr>
<tr>
<th>Name</th>
<td><?php echo $employee['e_name']; ?></td>
</tr>
<tr>
<th>Email adress</th>
<td><?php echo $employee['e_email']; ?></td>
</tr>
<tr>
<th>Phone number</th>
<td><?php echo $employee['e_phone']; ?></td>
</tr>
<?php
}
} else {
echo "0 results";
}
?>
</table>
</div>
</div>
</div>