I'm trying to get a small login page working and connecting to my tbl_Users table on my MySQL database. I have tried my best to set up a code that will check and link the values inputted on the home pages form and link it to the table on my database. But whenever I try to do a false login or a actual login all that get's generated is a blank page and I have no idea where I'm going wrong. Can someone point me in the right direction please.
Home_Page.php
<!DOCTYPE HTML>
<html>
<head>
<title>Please Login</title>
</head>
<body>
<form action="Login.php" method='POST'>
Username: <input type='text' name='username';><br>
Password: <input type='password' name='password'> <br>
<input type='submit' value='Log in'>
</body>
</html>
Login.php
include ('DatabaseConnect.php')
$username = $_POST['username'];
$password = $_POST['password'];
if ($username&&$password)
{
$query = mysql_query("SELECT * FROM tbl_Users WHERE User_Name='$username'");
$numrows = mysql_num_rows($query);
if ($numrows != 0)
{
while ($row = mysql_fetch_array($query))
{
$dbusername = $row ['User_Name'];
$dbpassword = $row ['Password'];
}
if ($username==$dbusername&&$password==$dbpassword
{
echo ("Welcome");
}
else
echo ("Incorrect Password");
}
else
die("That user doesn't exist!");
}
else
die("Please enter a valid username & password");
?>
Tbl_Users Create Code
CREATE TABLE `tbl_Users` (
`User_id` int(11) NOT NULL auto_increment, `First_Name` varchar(32) NOT NULL,
`Last_Name` varchar(32) NOT NULL, `Email` varchar(100) NOT NULL, `User_Name` varchar(100) NOT NULL,
`Password` varchar(100) NOT NULL, `User_level` int(11) NOT NULL, `Tickets_id` int(11) NOT NULL,
PRIMARY KEY (`User_id`), KEY `Tickets_id` (`Tickets_id`),
CONSTRAINT `tbl_Users_ibfk_1` FOREIGN KEY (`Tickets_id`)
REFERENCES `tbl_Tickets` (`Tickets_id`)) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1