我希望使用模式从数据库中显示有关该文件的更多信息,而不是向表中添加更多列,而不是打开新页面。 这是我的代码
<table id="file" class="table table-bordered table-striped table-hover">
<?php
$result = mysql_query("SELECT * FROM files")
?>
<thead>
<tr>
<th>ID <i class="fa fa-sort"></i></th>
<th>Name <i class="fa fa-sort"></i></th>
<th>Size <i class="fa fa-sort"></i></th>
<th>Delete </th>
</tr>
</thead>
<tbody>
<?php
while($row = mysql_fetch_array( $result )) {
?>
<tr class="record">
<td><?php echo $row['id'];?></td>
<td><?php echo $row['name']; ?> </td>
<td><?php echo $row['size']; ?> </td>
<td><div align="center"><a href="#" id="<?php echo $row['id'] ?>" class="infobutton fa fa-times" title="Info"></a></div></td>
<td><div align="center"><a href="#" id="<?php echo $row['id'] ?>" class="delbutton fa fa-times" title="Click To Delete"></a></div></td>
</tr>
<?php
}
?>
</tbody>
</table>
提前致谢。 如果有其他方式说出来的话。
答案 0 :(得分:0)
如果这是你的意思,你可以用PHP替换以下数据目标和模态ID。
<!--This calls the modal by data-target ID -->
<a data-toggle="modal" data-target="#myModal">This link calls the modal</a>
<!--modal content-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body">
<!-- your content goes here -->
</div>
<div class="modal-footer">
<center><button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button></center>
</div>
</div>