<?php include "config.php"; $username = $_POST['username']; //Take username on index.php $password = $_POST['password']; //Take password on index.php $user = mysql_query("SELECT * FROM login WHERE username='$username' AND password='$password'"); // Select login table username and password $match = mysql_num_rows($user); //Check all table query if($match==1){ //If user and password match, Login Success will appear. echo “Login Success”; }else if ($username == "" && $password == ""){ //If username and password form are blank. echo "Please fill username and password"; }else{ //If wrong username or password echo "Failed"; } ?>