【发布时间】:2017-03-04 12:27:10
【问题描述】:
我在尝试在两个模式窗口之间切换时遇到问题。请求您的指导
目标
在我的页面中,我有一个链接。当我单击该链接时,我的模态 1 打开。这个模型 1 有一个链接,当我点击它时会打开 2。
代码
示例页面 - 模态窗口 1 - 以下内容是模态 1 的一部分
<div class="row">
<div class="col-md-12">
<?php
if($_SESSION['role'] == "Business")
{ ?>
<div class="form-group" id="buscomments">
<a href="busscomments.php?id=<?php echo $response['id']; ?>" data-target="#busscomments" data-toggle="modal">View Business Comments</a>
</div>
</div>
<div class="col-md-12">
<?php }else { ?>
<div class="form-group" id="othcomments">
<a href="othcomments.php?id=<?php echo $response['id']; ?>" data-target="#othcomments" data-toggle="modal">View Other Comments</a>
</div>
<?php } ?>
</div>
现在在同一个 HTML 文件中 - 我还有两个其他模型
<div class="modal fade text-center" id="busscomments">
<div class="modal-dialog" role="document">
<div class="modal-content">
</div>
</div>
</div>
<div class="modal fade text-center" id="othcomments">
<div class="modal-dialog" role="document">
<div class="modal-content">
</div>
</div>
</div>
这些模态的模态内容在 busscmets.php 和 othcmets.php分别
输出:
我的模态 1 正确打开,但是当我单击理想情况下应该打开模态 2 的 busscmets.php 链接时,不会发生。我可以看到淡入淡出效果,但没有显示模态
我指的是:
我参考了以下链接并尝试修改我的代码但没有运气 Stackoverflow link 1
不确定我错过了什么。我知道传统使用 Jquery 来做同样的事情应该是理想的。但是这方面的任何帮助都会有所帮助。
如果我需要更多信息,请告诉我。
谢谢
更新:
Othcmets.php
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title">Other Comments</h4>
</div>
<div class="modal-body">
<div class ="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-1">Other Comments</th>
</tr>
</thead>
<?php
while(mysqli_stmt_fetch($statement))
{
$response = array("oth"=>$othcomments);
?>
<tbody>
<tr>
<td><?php echo $response['oth']; ?></td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
</div>
【问题讨论】:
-
你能显示 othcmets.php 的内容吗?那里可能有错误,但没有看到我们只是猜测。
-
@RayO'Donnell:谢谢。当然。我已经更新了我的问题
标签: php twitter-bootstrap