title: modal and while loop
body: <p>I have been scratching my head about this for days and i cant seem to understand why this isnt working,</p>
  
  <p>i have a modal which pops up when selecting the accept button, this modal should populate the users name and telephone number.</p>
  
  <p>the problem is that when you select the accept it only populate the first persons details and no the rest of the people in the table, i dont understand why if anyone can point out why i would be much obliged</p>
  
  <p>here is my code (sorry its abit messy at the moment):</p>
  
  <pre><code>&lt;?php
  
  require_once ("includes/session_check.php");
  
  require_once ("includes/db_connect.php");
  
  //MySqli Select Query
  $results = $mysqli-&gt;query("SELECT id, username, phone, requester,goodorbad,confirmed,denied FROM request WHERE goodorbad=1 AND confirmed=0 AND denied=0 Order by ID ASC");
  echo '
        &lt;!-- **********************************************************************************************************************************************************
        MAIN CONTENT
        *********************************************************************************************************************************************************** --&gt;
        &lt;!--main content start--&gt;
        &lt;section id="main-content"&gt;
            &lt;section class="wrapper site-min-height"&gt;
              &lt;h3&gt;&lt;i class="fa fa-angle-right"&gt;&lt;/i&gt; Non Authenticated Requests&lt;/h3&gt;
              &lt;div class="row mt"&gt;
                  &lt;div class="col-lg-12"&gt;
                  &lt;p&gt;Non Authenticated Requests here.&lt;/p&gt;';
  echo '&lt;div class="row mt"&gt;
                    &lt;div class="col-md-12"&gt;
                        &lt;div class="content-panel"&gt;
                            &lt;table class="table table-striped table-advance table-hover"&gt;
                                &lt;h4&gt;&lt;i class="fa fa-angle-right"&gt;&lt;/i&gt;Non Authenticated Requests&lt;/h4&gt;
                                &lt;hr&gt;  &lt;thead&gt;
                                &lt;tr&gt;
                                    &lt;th&gt;&lt;i class="fa fa-bullhorn"&gt;&lt;/i&gt;Username&lt;/th&gt;
                                    &lt;th&gt;&lt;i class="fa fa-phone"&gt;&lt;/i&gt;Phone number update request&lt;/th&gt;
                                    &lt;th&gt;&lt;i class="fa fa-bookmark"&gt;&lt;/i&gt;Requester&lt;/th&gt;
                                    &lt;th&gt;&lt;i class=" fa fa-edit"&gt;&lt;/i&gt; Status&lt;/th&gt;
                                    &lt;th&gt;&lt;i class=" fa fa-edit"&gt;&lt;/i&gt; Accept/Decline&lt;/th&gt;
                                    &lt;th&gt;&lt;/th&gt;
                                &lt;/tr&gt;
                                &lt;/thead&gt;';
  
  
  while($row = $results-&gt;fetch_object()) {
  
      //$row-&gt;id
     //$row-&gt;confirmed
       //$row-&gt;denied
  
  $status = $row-&gt;confirmed;
  
  echo ' 
      &lt;!-- Modal for Confirm --&gt;
  
                  &lt;form action="#" method="POST"&gt;
                      &lt;div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade"&gt;
                          &lt;div class="modal-dialog"&gt;
                              &lt;div class="modal-content"&gt;
                                  &lt;div class="modal-header"&gt;
                                      &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                                     &lt;input type="hidden" name="username_request" value="'.$row-&gt;username.'"/&gt;
                                         &lt;input type="hidden" name="telephone_request" value="'.$row-&gt;phone.'"/&gt;
                                      &lt;h4 class="modal-title"&gt;Are you sure ?&lt;/h4&gt;
                                  &lt;/div&gt;
                                  &lt;div class="modal-body"&gt;
                                      &lt;br&gt;
  
                                      &lt;p&gt;You are about to update &lt;/p&gt;
                                      '.$row-&gt;username.'
                                      &lt;br&gt;
                                      &lt;p&gt; with the following telephone number &lt;/p&gt;
                                        '.$row-&gt;phone.'
  
                                  &lt;div class="modal-footer"&gt;
                                      &lt;button data-dismiss="modal" class="btn btn-default" 
                                              type="button"&gt;Cancel&lt;/button&gt;
                                      &lt;button data-dismiss="modal" class="btn btn-default" 
                                              type="button"&gt;Submit&lt;/button&gt;
  
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;/form&gt;
                      &lt;!-- modal --&gt;
  
  
  
  
                                &lt;tbody&gt;
                                &lt;tr&gt;
                                    &lt;td&gt;&lt;a href="#"&gt;'.$row-&gt;username.'&lt;/a&gt;&lt;/td&gt;
                                    &lt;td&gt;'.$row-&gt;phone.'&lt;/td&gt;
                                    &lt;td&gt;'.$row-&gt;requester.' &lt;/td&gt;';
          if($status == 1){
  
  
                echo '       &lt;td&gt;&lt;span class="label label-success"&gt;Completed&lt;/span&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;/td&gt;
                        ';
          }else{
  
          }
  
                              echo '&lt;td&gt;&lt;span class="label label-info label-mini"&gt;Pending&lt;/span&gt;&lt;/td&gt;
  
                                    &lt;td&gt;
                                      Accept?  
                                      &lt;a data-toggle="modal" href="#myModal"&gt; &lt;button class="btn btn-success btn-xs"&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt;&lt;/button&gt;
                                       &lt;/a&gt;
                                     &lt;td&gt;
                                     Decline?
                                        &lt;button class="btn btn-danger btn-xs"&gt;&lt;i class="fa fa-minus-circle"&gt;&lt;/i&gt;&lt;/button&gt;
                                       &lt;/td&gt;
                                    &lt;/td&gt;
  
  
                              &lt;/tr&gt;
                                &lt;/tbody&gt;
  
  
  
  
  
                        ';
  }
  
  echo '     
                            &lt;/table&gt;
                        &lt;/div&gt;&lt;!-- /content-panel --&gt;
                    &lt;/div&gt;&lt;!-- /col-md-12 --&gt;
                &lt;/div&gt;&lt;!-- /row --&gt;';
  
  // close connection 
  $mysqli-&gt;close();
  ?&gt;
  
  &lt;html&gt;
  
  
  &lt;/html&gt;
  </code></pre>