我想在登录/注册后在我的表单上方收到成功或不成功的消息。 我正在使用带有一些 PHP 函数的 Boostrap 3。该消息位于我的导航栏上方,并在 3 秒后消失。这让我很困扰... 谢谢!
HTML 文件:
<form class="well form-horizontal" action="login.php" method="post" id="login_form" style="margin-top:50px;" name="login">
<legend><center><h2><b>Login</b></h2></center></legend><br>
---> here I want to receive the message
<div class="form-group">
....
</form>
注册.php
if (mysqli_num_rows($check_user) !== 0){
<button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
<h4><i class="icon fa fa-check"></i> Registered !</h4>
</div>';
}
脚本.js
$(document).ready(function () { $("#flash-msg").delay(3000).fadeOut("slow");});
最佳答案
进一步澄清我对您的问题的评论。移动 <div id="flash-msg"></div>
(或任何标签)从标题到您的内容区域的标签。另一种选择是使用不同的 html 元素来显示您的回复。
例如:
<form class="well form-horizontal" action="login.php" method="post" id="login_form" style="margin-top:50px;" name="login">
<legend><center><h2><b>Login</b></h2></center></legend><br>
<div id="login-flash-msg" style="display:none;"></div>
<div class="form-group">
....
</form>
然后将 script.js 更改为:
$(document).ready(function () { $("#login-flash-msg").delay(3000).fadeOut("slow");});
关于php - 如何更改登录位置或注册成功消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54078786/