プロジェクトにモーダルを表示するために、Twitter Boostrap JS の Modal プラグインを使用しています。PHPとデータベースを使用してメッセージを表示しています。メッセージには「返信」と「削除」オプションがあります (それぞれ 1 つのモーダル)。これらのモーダルに配列IDを渡したいのですが、どうすればいいですか?
ここに私の表示コード:
<p><?php echo $row['message'];?></p>
<input type="hidden" id="msgid" value="<?php echo $row['id']?>">
<a href="#replyModal" data-toggle="modal" class="reply-to"><i class="icon-share-alt"></i>Reply</a>
<a href="#deletemodal" data-toggle="modal" class="reply-to"><i class="icon-trash"></i>Delete</a>
ID をモーダルに渡して、アクションを実行できるようにします。
<div class="modal fade" id="replyModal">
<form action="replymsg.php" method="post" enctype="multipart/form-data">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Reply:</h3>
</div>
<div class="modal-body">
<input type="text" id="msgid"></input>
<textarea name="message" style="width:98%; height:100px;"></textarea>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Post Reply</button>
</div>
</form>
</div>