Modal在while循环中不起作用

时间:2016-10-25 06:34:09

标签: php

我有桌子。在td,我想显示按钮。点击按钮,模态将打开。我将模态放在while循环中,但它不起作用。

这里是疯狂的代码。

1)在td中,href传递给modal。

<td><a href="#info<?php echo $row['id'];?>" class="btn btn-warning" data-toggle="modal">View More</a></td>

2)以模态

获取的数据
 <?php 

 $res1 = mysqli_query($cn, "SELECT * from bal_post_property");
 while($row2 = mysqli_fetch_array($res1)){

 ?>  

 <div class="modal fade" id="info<?php $row2['id'];?>" role="dialog" aria-labelledby="myLargeModalLabel">
   <div class="modal-dialog modal-lg" role="document">
     <div class="modal-content">
        <div class="modal-header" style="border:none;">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="gridSystemModalLabel">View Full Information<?php echo $row2['id'];?></h4>
        </div>
        <div class="modal-body">
          <div class="row" style="padding:2px;">
            <div class="col-md-12" style="border:1px solid #ccc; ">
            <h4 style="font-weight:bold; color:#5bc0de">User Information</h4>
            <table class="table table-striped">
              <tbody>
                 <tr>
                    <td>Name</td>
                    <td><?php echo $row2['name']?></td>
                    <td>Contact</td>
                    <td><?php echo $row2['phone']?></td>
                 </tr>
                 <tr>
                    <td>Email</td>
                    <td><?php echo $row2['email']?></td>
                    <td>user</td>
                    <td><?php echo $row2['property_user']?></td>
                  </tr>
                  <tr>
                    <td>Project Name</td>
                    <td><?php echo $row2['project_name']?></td>
                    <td>Property For</td>
                    <td><?php echo $row2['project_for']?></td>
                  </tr>
                  <tr>
                    <td>Type</td>
                    <td><?php echo $row2['sub_type']?></td>
                    <td>City</td>
                    <td><?php echo $row2['city']?></td>
                  </tr>
                   <tr>
                     <td>Locality</td>
                     <td><?php echo $row2['locality']?></td>
                     <td>Address</td>
                     <td><?php echo $row2['address']?></td>
                   </tr>

                   <tr>
                     <td>Floors Allowed for construction</td>
                     <td><?php echo $row2['floor_construction']?></td>
                     <td>No of open sides</td>
                     <td><?php echo $row2['open_sides']?></td>
                   </tr>
                   <tr>
                     <td>Width of road facing plot </td>
                     <td><?php echo $row2['road_facing']?></td>
                     <td>Plot Area</td>
                     <td><?php echo $row2['plot_area']; ?><?php echo $row['plot_sqft']; ?></td>
                   </tr>
                   <tr>
                     <td>Construction Age</td>
                     <td><?php echo $row2['construction_age']?></td>
                     <td>Expected Price</td>
                     <td><?php echo $row2['expected_price']?></td>
                   </tr>
                   <tr>
                      <td>Brokerage</td>
                      <td><?php echo $row2['brokerage']?></td>
                      <td>Furnished status</td>
                      <td><?php echo $row2['2Furnished_status']?></td>
                   </tr>
                   <tr>
                      <td>Floor No</td>
                      <td><?php echo $row2['2Floor_No']?></td>
                      <td>Total Floors</td>
                      <td><?php echo $row2['2Total_Floors']?></td>
                    </tr>
                    <tr>
                       <td>Covered Area</td>
                       <td><?php echo $row2['2covered_area']?></td>
                       <td>Transaction Type</td>
                       <td><?php echo $row2['2Transaction_Type']?></td>
                    </tr>
                    <tr>
                       <td>Posession Status</td>
                       <td><?php echo $row2['2possession_status']?></td>
                       <td>Available From </td>
                       <td><?php echo $row2['2Available_From_month']?><?php echo $row['2Available_From_Year']?></td>
                    </tr>
                  </tbody>
              </table>
            </div>
          </div>  
       </div>
      </div>
     </div>
    </div>  

  <?php } ?>

1 个答案:

答案 0 :(得分:0)

只需输入一个attr data-target =“#info”

相关问题