【问题标题】:php - table click button, popup to display detailsphp - 表格点击按钮,弹出显示详细信息
【发布时间】:2018-10-31 01:25:02
【问题描述】:

当我点击每行表格中的查看按钮时如何显示详细数据(使用弹出窗口)?

按钮代码

echo '<button href="student.php?id="'.$row['mactrixNo'].'" onclick=document.getElementById("id02").style.display="block">View</button>';

弹出代码

<div id="id02" class="logform">
    <table border="1" class="tg w-100">
        <tr>
            <?php if(isset($_GET['id'])){
                $query='select *
                from student
                where mactrixNo="'.$_GET['id'].'"';
            }
            ?>

弹出时我无法获取“id”

【问题讨论】:

  • 你在使用引导 css/js 吗?
  • 是的,使用引导程序
  • 好的,我会添加答案

标签: javascript php html


【解决方案1】:

Bootstrap 提供了实现此目的所需的 HTML、CSS 和 JavaScript。 这是来自 v4 https://getbootstrap.com/docs/4.1/components/modal/

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

只要您的 &lt;head&gt; 部分中有 CSS 和 JS,您所需要做的就是编辑内容!

【讨论】:

  • 但是我还是有问题,弹出时无法从数据库中获取数据
  • echo 你的内容在div.modal-body ,替换...
猜你喜欢
  • 2016-04-04
  • 2018-06-17
  • 1970-01-01
  • 1970-01-01
  • 2018-10-25
  • 2013-09-21
  • 1970-01-01
  • 1970-01-01
  • 2012-05-29
相关资源
最近更新 更多