如果可以,我对你是正确的。
模态触发按钮
$row['ID']
$order .= '<td><a href="#myModal" id="custId" data-toggle="modal" data-id="'.$row['ID'].'">Edit</a></td>';
Bootstrap Modal事件以
$row['ID']使用Ajax方法获取值
$(document).ready(function(){ $('#myModal').on('show.bs.modal', function (e) { var rowid = $(e.relatedTarget).data('id'); $.ajax({ type : 'post', url : 'fetch_record.php', //Here you will fetch records data: 'rowid='+ rowid, //Pass $id success : function(data){ $('.fetched-data').html(data);//Show fetched data from database } }); });});模态HTML
<div id="myModal" role="dialog"> <div role="document"> <div > <div > <button type="button" data-dismiss="modal">×</button> <h4 >Edit Data</h4> </div> <div > <div ></div> //Here Will show the Data </div> <div > <button type="button" data-dismiss="modal">Close</button> </div> </div> </div></div>
最后创建
fetch_record.php,检索记录并以模态显示
<?php//Include database connectionif($_POST['rowid']) { $id = $_POST['rowid']; //escape string // Run the Query // Fetch Records // Echo the data you want to show in modal }?>


