如何在PHP中调用Bootstrap模态 [英] How to call bootstrap modal in php

查看:58
本文介绍了如何在PHP中调用Bootstrap模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调用在html文件中隐藏的模式,该文件与另一个模式隐藏在一起.当单击按钮时,其中一个出现,但是另一个将在验证过程中被php调用.

I'm trying to call a modal that I have in a html file which is hidden alongside another modal. One of them appears as the button is clicked but the other one is to be called by php as part of a verification process.

这是我的php代码:

$File = include("index2.html");
$Msg = 'Welcome ';
$search=$_POST['search'];
$query = $pdo->prepare("SELECT * FROM students WHERE IDs LIKE '%$search%'  LIMIT 0 , 10"); //OR author LIKE '%$search%'
$query->bindValue(1, "%$search%", PDO::PARAM_STR);
$query->execute();
// Display search result
         if (!$query->rowCount() == 0) {
                 echo '<script type="text/javascript">';
                                 echo 'alert("Verification Complete");';
                                  echo '</script>';



            while ($results = $query->fetch()) {

                $Studname = $results['Studentname'];


                echo '<script type="text/javascript">';                
                echo 'alert("'.$Msg.$Studname.'")';
                echo '</script>';



               echo '<script type="text/javascript">';
               echo '$(File).ready(function() {';
               echo '$("#myAdvert").modal("show");';
               echo '});';
               echo '</script>';

            }

         } else {
           echo '<script language="javascript">';
            echo 'alert("Sorry your ID was not found");';
            echo 'window.location.href = "/Koleesy/index.html";';
            echo '</script>';
        }
?>

在欢迎用户之后,我希望调用index.html中的隐藏模式,以便用户可以继续提交广告. 我试过使用include函数,但这似乎对我不利. 我该怎么做呢? 每个答案表示赞赏.

After the user is welcomed I want the hidden modal from my index.html to be called so the user can continue submitting the advert. I've tried using the include function but that doesn't seem to work in my favor. How do I do this? Every answer is appreciated.

推荐答案

尝试一下:

echo "<script type='text/javascript'>
$(document).ready(function(){
$('#myAdvert').modal('show');
});
</script>";

这篇关于如何在PHP中调用Bootstrap模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆