dpdfh60088 2016-10-29 18:57
浏览 43
已采纳

如何将GET值传递给bootstrap模式

i have a bootstrap modal and am trying to pass a unique value through GET to the modal but the modal keeps getting the same unique value instead of the value of the table row i clicked. Been struggling with this for days and cant seem to figure out why it's not working. The code is below

<?php
    $sql = "SELECT * FROM houses"; 
    $q=$conn->query($sql);
   while ($row = mysqli_fetch_array($q)) {
?>
<tr>
    <td><?php echo $row['nickname']; ?></td>
    <td><?php echo $row['state']; ?></td>
    <td><?php echo $row['city']; ?></td>
    <td><?php echo $row['address']; ?></td>
    <td>    
        <div class="btn-group">
            <a class="btn btn-success" href="view_property.php?house=<?php echo $row['nickname']; ?>"><i class="icon_check_alt2"></i></a>
            <a class="btn btn-primary" href="edit_property.php?house=<?php echo $row['nickname']; ?>"><i class="icon_plus_alt2"></i></a>
            <a class="btn btn-danger"  data-toggle="modal" data-target="#myDelete"><i class="icon_close_alt2"></i></a>
        </div>
        <div id="myDelete" class="modal fade" role="dialog">
            <div class="modal-dialog">
            <!-- Modal content-->
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Delete Property</h4>
                    </div>
                    <div class="modal-body">
                        <p>Are you sure you want to pull out this property from your list of Properties, as all data regarding this property will be lost permanently <?php echo $row['nickname']; ?></p>
                    </div>
                    <div class="modal-footer">
                        <a class="btn btn-success" href="view_property.php?house=<?php echo $row['nickname']; ?>">Delete</a>
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    </div>
                </div>    
            </div>
        </div>
</td>
  • 写回答

1条回答 默认 最新

  • douhuan1497 2016-10-29 21:00
    关注

    HTML ids should be unique, you're using the same id for every iteration.

    Try using:

    id="myDelete<?php echo $row['id'] ?>"
    data-target="#myDelete<?php echo $row['id'] ?>"
    

    Hope this helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?
  • ¥15 讲解电路图,付费求解