title: Pass PHP variable to bootstrap modal
body: <p>I have a button that is created using a while loop. so the while loop creates a table row for each row in a mysql table.</p>
  
  <p>I have one line of code for the button which is created again for each row of the table and each button has a different value based on the <code>id</code> for that record.</p>
  
  <pre><code>$order .= '&lt;td&gt;&lt;a href="#myModal" class="btn btn-default btn-small" id="custId" data-toggle="modal" data-id="'.$row['ID'].'"&gt;Edit&lt;/a&gt;&lt;/td&gt;';
  </code></pre>
  
  <p>The problem is that I want to use that <code>$row['ID']</code> and view it in a modal so I can retrieve the record with the same ID using mysqli query.</p>
  
  <p>Here is the code for the modal.</p>
  
  <pre><code>&lt;div class="modal fade" id="myModal" role="dialog"&gt;
          &lt;div class="modal-dialog"&gt;
              &lt;!-- Modal content--&gt;
              &lt;div class="modal-content"&gt;
                  &lt;div class="modal-header"&gt;
                      &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                      &lt;h4 class="modal-title"&gt;Edit Data&lt;/h4&gt;
                  &lt;/div&gt;
                  &lt;div class="modal-body"&gt;
                      i want to save the id in a variable here so i can use it in a php script for this modal
                  &lt;/div&gt;
                  &lt;div class="modal-footer"&gt;
                      &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>