首先对糟糕的英语感到抱歉。我需要使用带有引导模型和 ajax 的 PHP 来验证数据库中的数据。我尝试这样做:
我创建一个index.php文件和action.php文件。然后使用 ajax 并尝试从 action.php 文件加载action.php我尝试验证我的登录详细信息。
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Webslesson Tutorial | Make Login Form by Using Bootstrap Modal with PHP Ajax Jquery</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body>
<br/>
<div class="container" style="width:700px;">
<h3 align="center">Make Login Form by Using Bootstrap Modal with PHP Ajax Jquery</h3><br />
<br />
<br />
<br />
<br />
<br />
<?php
if(isset($_SESSION['username']))
{
?>
<div align="center">
<h1>Welcome - <?php echo $_SESSION['username']; ?></h1><br />
<a href="#" id="logout">Logout</a>
</div>
<?php
}
else
{
?>
<div align="center">
<button type="button" name="login" id="login" class="btn btn-success" data-toggle="modal" data-target="#loginModal">Login</button>
</div>
<?php
}
?>
</div>
<br />
</body>
</html>
<div id="loginModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Login</h4>
</div>
</div>
</div>
</div>
</div>
慕雪6442864