I have made a while loop where there is a button. That button need to call a bootstrap modal shown below.
So I am not quite sure how to do this. Do I have to give my modal a name, and set that name on the button? Should the modal code go inside the while loop?
index.php
while($row = $res->fetch_assoc()) {
echo "id: " . $row["id"]. "<br>" .
"<button type="submit" class="btn btn-warning">Read More </button>";
}
The modal:
<!-- This is my modal -->
<div class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<!-- A lot of irrelevant code for the question -->
</div>
</div>
</div>
</div>
<script>$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus()
})</script>