从while循环调用模态

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>

It’s difficult to answer because there are not enough element in your question to understand what you want to achieve.

But, i would say that you need only one modal code outside the loop.

You generate all the buttons you need in the loop. They all call your modal and you update with some JS the modal content each time it is called.