1

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>
Community
  • 1
  • 1
Sriram
  • 449
  • 3
  • 8
  • 15

1 Answers1

0

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

Sriram
  • 449
  • 3
  • 8
  • 15