出于某种原因,当我点击我的表单的登录按钮时,它会重定向到php页面,然后给我HTTP错误500.我是PHP的新手,我不确定我做错了什么。< / p>
这是我的HTML文件中没有很多CSS的内容
<body style="background-color: #ff0000">
<div class="form">
<form action="login.php" method="POST">
<input id="w" type="text" name="Username" placeholder="Username">
<input id="w" type="password" name="Password" placeholder="Password">
<input id="s" type="submit" value="Submit"> <!--Do login checking stuff here, then go to staff homepage --->
</form>
<form action="index.html" style="margin: 0">
<input id="s" type="submit" value="Go Back">
</form>
</div>
</body>
这是我的PHP文件
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$conn = mysql_connect("localhost", "root", "");
$db = mysql_select_db($conn, "id1394453_users");
$result = mysql_query("SELECT * FROM Users WHERE username = '$username' AND password = '$password'")
or die("Failed to query database".mysql_error());
$row = mysql_fetch_array($result);
if ($row['username'] == $username && $row['password'] == $password) {
echo "Login Success!".$row['username'];
} else {
echo "Failed to Login!"
}
&GT;