简体   繁体   中英

How to show a bootsrap modal popup using inside php code

I want to display this modal popup after php condition check

<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>

in this php code used for display the popup. But it cannot display.

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

I think it's much better if you show you modal by default and put it in the php condition like :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM