从表单中打开模态

时间:2014-08-21 20:01:30

标签: php html modal-dialog

您好我有一个链接,一旦点击打开一个模态。问题是我想将一个php变量传递给模态,以便我可以运行MYSQL查询。

这是我目前的链接

  <?php echo "<a href=\"#modalForm\" class='modal-with-form btn btn-default'>Update Status</a>";?>

我要做的是发送这样的表格。

     <form action="<a href='#modalForm'></a>" method="get" class="modal-with-form btn btn-default">
      <input type="hidden" name="usern" value="<?php echo "$usern"; ?>">
     <input name="" type="button">
    </form> 

当我点击按钮时,屏幕变暗但表格没有打开。有可能这样做吗?

2 个答案:

答案 0 :(得分:0)

你需要用jquery,

来实现它
$('.modal-with-form').submit(function(e){
    e.preventDefault();
    // Modal code here
});

然后替换&#34; //模态代码的注释&#34;用你的模态代码

答案 1 :(得分:0)

我找了一会儿,发现了http://www.forosdelweb.com/f13/pasar-variable-php-ventana-modal-1059193/

希望这能帮到你的朋友! (Y)