我完全不熟悉这种框架。
我为我的网站创建了一个登录页面(使用html)。我想用数据库(MySQL)验证用户名和密码。为此,我尝试将用户名和密码从html代码发布到php代码,从中连接到MySQL服务器数据库并验证登录凭据。
下面是我的html代码-Login.html
<html>
<head>
<title>Welcome! Login here.</title>
</head>
<body>
<form action="check_user-pass.php" method="POST">
<h3>Please Login</h3>
User Name: <input type="text" name="user_name"><br>
Password: <input type="password" name="password">
<input type="submit" name="submit" value="Login!">
</form>
</body>
</html>
在继续测试我的php代码之前,我注意到所有的php代码都显示在浏览器窗口上(在浏览器窗口上下载)。
Login.html和check_user-pass.php都在同一目录下。
在这个阶段,我不知道该如何继续下去。请帮帮我
将login.html页面中的登录凭据传递给php,以根据MySQL数据库进行验证/验证。
将结果发布回html文件以显示在网页上,即,我想验证用户的登录凭据,并使用html文件中的Firstname(数据库表中的列之一)显示在我的网站上。
我不确定将.html和.php文件放在同一目录中是否正确
谢谢,
普里亚
最佳答案
您需要先配置服务器。不能像在浏览器中打开HTML文件那样打开php文件。例如,当访问index.html时,您只需在地址栏中键入:Directory/index.html,在php中,例如,您正在使用XAMPP或WAMPP目录,您可以在地址栏中指定:localhost/Directory/index.php
查看此简短教程:http://www.tutorialspoint.com/shorttutorials/run-a-php-program-in-xampp-server
关于php - 验证在网站上输入的用户名密码与MySQL数据库上的密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21521359/