duanchun2349 2017-03-04 12:27
浏览 18

PHP + bootstrap - 在模态之间切换

I am facing issue while trying to switch between two modal windows. Requesting you guidance on the same

Objective

In my page, i have a link. When i click that link my modal 1 opens. This model 1 has a link which when i click opens 2.

Code

Sample page - Modal window 1 - Contents below are part of Modal 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>

Now in the same HTML File - I have two other models

  <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>

Modal content of these modals are available in busscomments.php and othcomments.php respectively

Output :

My Modal 1 opens correctly but when i click busscomments.php link which should ideally open modal 2, does not happen. i could see the fade effect but no modal is displayed

What i referred :

I refered the below links and try to modify my code but no luck Stackoverflow link 1

Not sure What i am missing. I understand that traditional use of Jquery to do the same should be ideal. But any help in this regard would be helpful.

Please let me know if more information is required from my end.

Thanks

UPDATE :

Othcomments.php

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">&times;</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>
  • 写回答

1条回答 默认 最新

  • dongxie9169 2017-03-04 17:31
    关注

    MY BAD.. I absolutely messed up calling the modal ID's. I interchanged the Id's and there was no result from the database. I fixed the issue. Thank you

    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?