title: Passing Jquery variable to php within a modal
body: <p>I am printing out pictures and names (in a grid view). The user will be able to click on the picture or the name, and this will open up a modal with the title of the picture/name (which will be the same) which was clicked.</p>
  
  <pre><code>&lt;?php
      $i = 0;
      while ($row = mysqli_fetch_assoc($data)) {
          print '&lt;li&gt;';
          print '&lt;a class="btn btn-default" data-toggle="modal" data-target=".bs-example-modal-lg"&gt;&lt;img src="'.$row["image"].'" /&gt;&lt;/a&gt;&lt;br&gt;';
          print '&lt;a class="btn btn-default" data-toggle="modal" data-target=".bs-example-modal-lg"&gt;&lt;h4&gt;'.$row['name'].'&lt;/h4&gt;&lt;/a&gt;';
          print '&lt;/li&gt;';
      }
  ?&gt;
  </code></pre>
  
  <p>When the image/name is clicked, how do I store the image path or the name that was clicked to a variable and send it to php so I can run a query and get more information (based on the click) to populate the modal?</p>
  
  <p>I was reading this other post: <a href="https://stackoverflow.com/questions/5202070/how-to-pass-jquery-variables-to-php-variable">How to pass jQuery variables to PHP variable?</a>
  But it is only for a single case, how would I pass variables which are printed out using a while loop?</p>
  
  <p>WOuld the <code>data-id</code> tag of modals be useful here?</p>