我有个问题。我有一些 php 脚本可以在我的数据库中创建帖子列表。
这是代码
<td><?php echo "$r[date_create]"; ?></td>
<td><?php echo "$r[date_update]"; ?></td>
<td><?php echo "$r[hitcount]"; ?></td>
<td>
<a href="edit.php?id=<?php echo "$r[id]"; ?>"><i class="icon-pencil"></i></a>
<a href="#myModal" role="button" data-toggle="modal" id="<?php $r[id]; ?>">
<i class="icon-remove"></i></a>
</td>
此语法调用名为 MyModal 的模态
如您所见,锚 (
<a href="#myModal"
) 根据数据库获取一些 id
但我不能将 php 脚本生成的值传递给我的模态窗口
这是模态窗口语法
<div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Delete Confirmation</h3>
</div>
<div class="modal-body">
<p class="error-text">Are you sure you want to delete the post?</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<a class="btn btn-danger" data-dismiss="modal" href="delete.php?id=THE ID SHOULD BE HERE ">Delete</a>
</div>
</div>
我想将上面锚点的 ID 放在 delete.php?id=THE ID SHOULD BE HERE
怎么做?
先感谢您