如何使用内部PHP代码显示一个bootsrap模式弹出窗口

时间:2016-04-21 18:05:00

标签: javascript php

我想在php条件检查后显示这个模态弹出窗口

<div id="myModal65" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Subscribe our Newsletter</h4>
            </div>
            <div class="modal-body">
                <p>Subscribe to our mailing list to get the latest updates straight in your inbox.</p>
                <form>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Name">
                    </div>
                    <div class="form-group">
                        <input type="email" class="form-control" placeholder="Email Address">
                    </div>
                    <button type="submit" class="btn btn-primary">Subscribe</button>
                </form>
            </div>
        </div>
    </div>
</div>

在这个用于显示弹出窗口的php代码中。但它无法显示。

<?php
    if($intwschdle==1)
           {
      echo "<script type='text/javascript'>$('#myModal65').modal('show');</script>";            
           }
?>

1 个答案:

答案 0 :(得分:0)

我认为如果你默认显示模态并将其置于php条件下会更好:

 <?php
if($intwschdle==1){   
?>
<!--full html for modal goes here showing by default - - >
<?php  } ? >