用php触发器切换Bootstrap模态 [英] Toggle Bootstrap modal with php trigger
本文介绍了用php触发器切换Bootstrap模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果设置了PHP GET URL,但我不知道如何操作,我需要触发Bootstrap模式.
I need to trigger a Bootstrap modal if a PHP GET url is set but I don't know how to.
PHP代码如下:
<?php
if ($_GET['activate']) {
$activate = $_GET['activate'];
mysql_query("UPDATE `users` SET `active` = 1 WHERE `email_code` = '$activate'");
}
?>
在mysql查询后,但仍在是否需要模态触发的情况下.我考虑过json,但对创建我自己的代码不了解.显示模式的javascript是这一行:
After the mysql query but still in the if I need the modal to trigger. I've considered json but don't know enough to create my own code. The javascript to show the modal is this line:
$('#myModal').modal('show')
我该如何翻译才能与我的PHP触发器一起使用?
How would I translate that to work with my PHP trigger?
推荐答案
添加检查状态的变量
$show_modal = false;
然后将其设置为true
And in your get set it to true,
if ($_GET['activate']) {
$activate = $_GET['activate'];
mysql_query("UPDATE `users` SET `active` = 1 WHERE `email_code` = '$activate'");
$show_modal = true;
}
现在在您的html中:
Now in your html :
<?php if($show_modal):?>
<script> $('#myModal').modal('show');</script>
<?php endif;?>
这篇关于用php触发器切换Bootstrap模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文