<!DOCTYPE html>
<html lang = "en">
<meta name = "viewport" content = "width = device-width, initial-scale = 1.0">
<meta charset = "UTF-8">
<title>
PHP Project
</title>
<p align = "centre">
<form action = "LoginPage.php" method = "POST">
<b>
<i>
Username: <input required = "required" type = "text" name = "Username" placeholder = "Enter Username">
</i>
</b>
<br>
<br>
<b>
<i>
Password: <input required = "required" type = "password" name = "Password" placeholder = "Enter Password">
</i>
</b>
<br>
<br>
<input type = "submit" name = "Login" value = "Login">
</form>
</p>
<?php
include "DataBase.php";
error_reporting(0);
$password = $_POST [ "Password" ];
$username = $_POST [ "Username" ];
echo"<b>";
if ($username == Null || $password == Null)
{
echo "________________________________________________Please enter your
Username and Password to Log In into the system.________________________________________________";
}
else if ($username != "CWIT" || $password != "Admin@194006")
{
echo "________________________________________________Invalid Credentials!
Please enter the correct Username and Password.________________________________________________";
}
echo"</b>";
?>
</html>
If the username = CWIT and password = Admin@194006 I want my application to go to HomePage.php How do I do that?
Following is the code in the file I have included DataBase.php
<!DOCTYPE html>
<html>
<?php
echo "<b>";
error_reporting(0);
$servername = "localhost";
$username = "root";
$password = "";
$database = "attendance";
$connect = mysqli_connect($servername, $username, $password, $database);
if (!$connect)
{
die ("___________________________________Failed to establish a connection: ".mysqli_connect_error().
".___________________________________");
}
else
{
echo "___________________________________________The details will be recorded
as a connection to the database has been established.___________________________________________<br> <br>";
}
echo "</b>";
?>
</html>
I tried adding code in the if else block to link the loginpage to the homepage if the username and password were correct but that didn't work.