Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用<;发送参数;a>;用于在smarty&;中设置查询MySQL;Php_Php_Mysql_Twitter Bootstrap_Bootstrap Modal - Fatal编程技术网

如何使用<;发送参数;a>;用于在smarty&;中设置查询MySQL;Php

如何使用<;发送参数;a>;用于在smarty&;中设置查询MySQL;Php,php,mysql,twitter-bootstrap,bootstrap-modal,Php,Mysql,Twitter Bootstrap,Bootstrap Modal,我想在smarty/php中使用引导创建网格 在网格中,我有名字、家庭、&编辑按钮。 当我在btn编辑中单击时,模式弹出窗口打开,但我不知道如何发送记录ID,以便在模式中进行设置查询和显示: 示例代码: btn: <a href="" class="btn btn-success" data-toggle="modal" data-target="#myModal" data-backdrop="static"> Edit User </a> <!-

我想在smarty/php中使用引导创建网格
在网格中,我有名字、家庭、&编辑按钮
当我在btn编辑中单击时,模式弹出窗口打开,但我不知道如何发送记录ID,以便在模式中进行设置查询和显示:
示例代码:

btn:

<a href="" class="btn btn-success" data-toggle="modal" data-target="#myModal" data-backdrop="static">
  Edit User
</a>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        username: ...
        <br>
        Password: ...
        <br>
        avatar: ...
        <br>
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

模态:

<a href="" class="btn btn-success" data-toggle="modal" data-target="#myModal" data-backdrop="static">
  Edit User
</a>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        username: ...
        <br>
        Password: ...
        <br>
        avatar: ...
        <br>
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

×
情态标题
用户名:。。。

密码:。。。
阿凡达:。。。
... 接近 保存更改
最简单的解决方案:

  • 删除属性
    data toggle=“modal”
    data target=“#myModal”
  • 为标签
    a添加
    数据id
    属性
  • 将bind jquery添加到
    单击标记
    a
  • 当用户单击标记时:
    • 将记录ID插入模式表单中的隐藏文本输入
    • 手动运行引导模式
      $('#myModal')。modal()
希望能有所帮助

编辑:

<a href="" class="btn btn-success" data-toggle="modal" data-target="#myModal" data-backdrop="static">
  Edit User
</a>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        username: ...
        <br>
        Password: ...
        <br>
        avatar: ...
        <br>
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
在文档中,我还看到了在模式运行时发生的特殊事件(可能更多的是bootstrap.js方式…):

因此,您可以使用e.target获取标记
a