Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution is pretty simple. You actually just mode the hidden input into the modal form and there you go. You got the ID when it posts.</p> <pre><code>&lt;div class="modal fade" id="replyModal"&gt; &lt;form action="replymsg.php" method="post"&gt; &lt;input type="hidden" id="msgid" value="&lt;?php echo $row['id']; ?&gt;" /&gt; &lt;div class="modal-header"&gt; &lt;a class="close" data-dismiss="modal"&gt;×&lt;/a&gt; &lt;h3&gt;Reply:&lt;/h3&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;textarea name="message" style="width:98%; height:100px;"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;button type="submit" class="btn btn-primary"&gt;Post Reply&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>If you do not have access for the modal window in your PHP for some reason then use jQuery to on click of the a tag set the id of the row to delete on a hidden input field inside the form within the modal popup.</p> <p>-</p> <p><strong>Edit - Added JavaScript example</strong> - Test: <a href="http://jsfiddle.net/3A7Mg/" rel="nofollow">http://jsfiddle.net/3A7Mg/</a> <em>(This only shows you if you inspect the modal div that when you click on the reply link it adds a hidden input field to it.)</em></p> <p><strong>Use JavaScript below:</strong></p> <pre><code>$(document).ready(function () { $('a.reply-to').click(function (e) { var $exists = $('#replyModal form input#dbid'); if($exists.length == 0) { $('#replyModal form').prepend('&lt;input type="hidden" id="dbid" name="dbid" value="'+$('#msgid').val()+'" /&gt;'); } }); }); </code></pre> <p>Then when the user submit the form you will in PHP POST have a index named "dbid" as so:</p> <pre><code>$_POST['dbid'] </code></pre> <p>​</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload