<body>
<div class="login-card">
<h1>Log-in</h1><br>
<form action="incident-form.php" method="POST">
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<input type="submit" name="submit" class="login login-submit" value="Login">
</form>
<div class="login-help">
<a href="#">Register</a> <a href="#">Forgot Password</a>
</div>
</div>
</body>
</html>
<?php
$connect = mysql_connect("localhost", "root", "");
mysql_select_db("aid");
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$query = mysql_query("SELECT * FROM users WHERE username='".$username."'");
if (mysql_num_rows($query) > 0){
while($row = mysql_fetch_assoc($query)) {
if ($row = ['password'] == $password){
echo "Successfully logged in!";
}else{
echo "Wrong password";
}
}
}else{
echo "Username not found";
}
}
?>
I'm using phpMyAdmin with PHP 5.5. My db name is aid and table is users. The form is there, the db and table are there but it goes straight to the target page on submit without checking the users.