title: passing a php variable dynamically to a bootstrap modal
body: <p>I have a php loop that writes hundrends of records, I need to have a button on each line to trigger a bootstrap modal that will allow to edit this specific record. can't really sent the line ID (it's a user ID) via GET since the URL doesn't change, or by POST since the page doesn't refresh ... I tried with AJAX but could seem to figure it out. </p>
  
  <p>in my file the php variable is $userID= some number; ... which changes at every line</p>
  
  <p>so every line refers to the same modal in which i added a data-id (or is there any other way to pass tha value to my modal?)</p>
  
  <pre><code>&lt;a href="#" class="btn btn-success"
  data-toggle="modal"
  data-target="#editUser"
  id="theuser"
  data-id="&lt;?php echo $userID;?&gt;"&gt; 
  Update
  &lt;/a&gt;
  </code></pre>
  
  <p>How can I retrieve $userId in the modal so I can do an Mysql query on it ? (i understand there is a seperation between the server side aspect of php and the fact the data-id is only browser based ... but there must be a way to generate dynamically content using php for a modal ?  </p>
  
  <p>thanks in advance!</p>