title: Pass id value from ahref to bootstrap modal php
body: <p>I have a php code that creates a list from the database. One of the items I retrieve from the database is the row id.  I create the list in the following code:</p>
  
  <pre><code>    &lt;th&gt;Cover Name&lt;/th&gt;
        &lt;th&gt;Sum Insured&lt;/th&gt;
        &lt;th&gt;Info&lt;/th&gt;
        &lt;th style="width: 3.5em;"&gt;&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;?php while($row = mysql_fetch_array($query_set)) { ?&gt;
      &lt;tr&gt;
  
        &lt;td&gt;&lt;?php echo $row['cover_name'] ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo 'R '.$row['sum_insured'] ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $row['info'] ?&gt;&lt;/td&gt;
        &lt;td&gt;
            &lt;a href="cover-type.php?id=&lt;?php echo $row['coverid']?&gt;"&gt;&lt;i class="fa fa-pencil"&gt;&lt;/i&gt;&lt;/a&gt;
           &lt;a href="#myModal" onclick="&lt;?php $coverid = $row['coverid'] ?&gt;" role="button" data-toggle="modal"&gt;&lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;&lt;/a&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;?php } ?&gt;
        &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The syntax for calling <code>#myModal</code> </p>
  
  <pre><code>&lt;a href="#myModal" onclick="&lt;?php $coverid = $row['coverid'] ?&gt;" role="button" data-toggle="modal"&gt;&lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;&lt;/a&gt;
  </code></pre>
  
  <p>as you can see the anchor <code>#myModal</code> and <code>onclick</code></p>
  
  <p>After clicking anchor I would like to pass <code>$coverid</code> to the following myModal pop up </p>
  
  <pre><code>    &lt;div class="modal small fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&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;×&lt;/button&gt;
              &lt;h3 id="myModalLabel"&gt;Delete Confirmation&lt;/h3&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
              &lt;p class="error-text"&gt;&lt;i class="fa fa-warning modal-icon"&gt;&lt;/i&gt;Are you sure you want to delete the cover?&lt;br&gt;This cannot be undone.&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class="modal-footer"&gt;
              &lt;button class="btn btn-default" data-dismiss="modal" aria-hidden="true"&gt;Cancel&lt;/button&gt;
              &lt;a href="delete-cover.php?id=&lt;?php echo $coverid ?&gt;" class="btn btn-danger"  &gt;Delete&lt;/a&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I under the impression that I need to have some form a hidden javascript variable in </p>
  
  <pre><code>&lt;a href="#myModal" onclick="&lt;?php $coverid = $row['coverid'] ?&gt;" role="button" data-toggle="modal"&gt;&lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;&lt;/a&gt; and pass it to myModal window, but how do I do that ?
  </code></pre>