dotws86260 2018-07-06 17:02
浏览 67

如何在带有href的Bootstrap模式中使用GET方法? [关闭]

Everytime I try to do this, the URL shows up like this: ?id=. The id is empty. Here is what I did:

echo '<a  href="#small?id="'.$row['id'].'"" id="smallbtn" data-toggle="modal" data-modal="small">';

And for the modal:

    <div class='modal fade' id='small?id=<?php <-- Here is what is used to call the #small 
$username = $_SESSION['username'];
$db = mysqli_connect("localhost", "root", "password", "testdb");
$sql = "SELECT * FROM user WHERE username = '$username' ORDER BY id DESC";
$result = mysqli_query($db, $sql);
while ($row = mysqli_fetch_array($result)) {
echo    '"'.$row["id"].'"';
}
?>' role='dialog'></div>

Also what happened is that nothing shows up when I click the href. I think it has something to do with how I setup up the modal code above. When I checked for other questions similar, I read that PHP GET Method is not dynamic so that might be the issue as well. Is there a way I can fix this problem?

UPDATE: The URL shows correctly, but the modal does not display.

  • 写回答

3条回答 默认 最新

  • doumen9709 2018-07-06 17:22
    关注

    <?php 
    $id= $row['id'];
     echo '<a  href="small.php?id='.$id.'" id="smallbtn" data-toggle="modal" data-modal="small">Modal</a>';
     ?>
    //OR
    echo '<a  href="small.php?id='.$row['id'].'" id="smallbtn" data-toggle="modal" data-modal="small">modal</a>';

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算