title: Dynamically load information to Twitter Bootstrap modal
body: <p><strong>Problem:</strong></p>
  
  <p>I would like to transfer by using jQuery a value in an link-attribute to PHP/SQL query.</p>
  
  <p><strong>HTML code:</strong></p>
  
  <pre><code>&lt;a data-toggle="modal" href="#myModal" id="1"&gt;&lt;i class="pull-right icon-eye-open"&gt;&lt;/i&gt;HTML&lt;/a&gt;
  </code></pre>
  
  <p><strong>PHP code:</strong></p>
  
  <pre><code>&lt;div id="myModal" class="modal hide fade"&gt;
      &lt;div class="modal-header"&gt;
        &lt;button class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
        &lt;h3&gt;Title&lt;/h3&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;            
          &lt;?php
              $query = "SELECT * FROM table WHERE id = ID FROM JQUERY HERE";
              $result = mysql_query($query) or die ('Error (' . mysql_errno() . ') ' . mysql_error());
          ?&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;a href="#" class="btn btn-info" data-dismiss="modal" &gt;Close&lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Scenario:</strong></p>
  
  <p>When the user clicks the link-element that has data-toggle="modal" then jQuery should take the value of the id-attribute (which is 1 in this case) and send it to the SQL-query so that the SQL query would look like:</p>
  
  <pre><code>$query = "SELECT * FROM table WHERE id = 1";
  </code></pre>
  
  <p><strong>jQuery code:</strong></p>
  
  <pre><code>$("a[data-toggle=modal]").click(function(){
      var essay_id = $(this).attr('id');
      //Find $essay set it to essay_id in PHP
      //Alternatively create a $_SESSION['EID'] here
  });
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>How do I use jQuery to set a variable ($essay) in PHP? or how can I create a session variable in PHP through jQuery?</p>