title: How do i pass the ID of a row from my database to a modal dialog?
body: <p>I have a modal dialog that i want it to display specific fields of a row in my database basing on the ID of that particular row. Im trying to pass the row ID from the database to the modal dialog so that i can use it for the query but im having challenges, how do i get this done?</p>
  
  <pre><code> &lt;?php
  
      $result = mysqli_query($con,"SELECT * FROM general_reservation ");
      $count = mysqli_num_rows($result);
  echo "&lt;b&gt;&lt;center&gt;&lt;h3&gt;Cars Reserved By Districts&lt;/h3&gt;&lt;/center&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;";
  
  while($row=mysqli_fetch_array($result)){
      $reservation_id = $row['reservation_id'];
      ?&gt;
  
      &lt;tr&gt;
           &lt;td&gt;&lt;a  name="reserver"  data-id="myModal"  class="btn btn-link" data-toggle="modal" href="#myModal" &gt;Reserver's Profile&lt;/a&gt;&lt;/td&gt;
  
      &lt;/tr&gt;
  
      &lt;?php
  $reserver = $row['reservation_id'];
      } //end of while loop ?&gt;
  
      &lt;/tbody&gt;
  &lt;/table&gt; 
  &lt;div class="modal fade" id="myModal" role="dialog"&gt;
               &lt;div class="modal-dialog modal-sm"&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;&lt;center&gt;Reserver&lt;/center&gt;&lt;/h4&gt;
              &lt;/div&gt;
              &lt;?php 
              $reserver = $row['reservation_id'];
  
          $reservation_id = 'reservation_id' ;
          $result = mysqli_query($con,"SELECT * FROM general_reservation WHERE reservation_id = '$reserver' ");
          $count = mysqli_num_rows($result);
          while($row=mysqli_fetch_array($result)){
  
                  ?&gt;
          &lt;div class="modal-body"&gt;
          &lt;p &gt;&lt;strong&gt;First Name: &lt;/strong&gt;&lt;?php echo $row['fname'];?&gt; &lt;/p&gt;&lt;br&gt;
          &lt;p &gt;&lt;strong&gt;Last Name: &lt;/strong&gt;&lt;?php echo $row['lname'];?&gt;&lt;/p&gt;&lt;br&gt;
          &lt;p &gt;&lt;strong&gt;Mobile Number: &lt;/strong&gt;&lt;?php echo $row['mobile_number'];?&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;?php } //end of while loop ?&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>