Tuesday, March 29, 2022

Making a working Login Form using HTML and PHP

 Hi and Welcome to this first post of this new blog. This is Calvin and I love coding. I only know a bit but I still can help you learn coding out of this blog. Without further ado, Let's start with the topic.


How to make a working Login form using HTML and PHP

Now lets get started first with HTML. Add a file called index.html. If the filename is index. users don't have to type /index.html after the domain name. Lets try not to use cookies and CSS to make it easy. HTML can be used for the form itself. Here is the code

index.html



<!DOCTYPE html>
<html>
     <head>
         <title>Please Login</title>
     </head>
     <body>
         <h1>Login to Pro 70>
         <form method="post" action="login.php">
             <label for="Username">Enter your Username</label>
             <input type="text" name="Username" placeholder="Username">
             <br><br>
             <label for="Password">Enter your Password</label>
             <input type="password" name="Password" placeholder="Password">
             <br>
             <input type="submit" value="Login">
             <input type="reset" value="Clear">
         </form>
     </body>
<html>



Now that were done with HTML, Let's move to PHP to check that the Username and Password is correct. First you need to install it first. Go to the PHP official Website to install it. Follow the instructions provided to install it. After you are done installing PHP, you can proceed to the next step.

Create a file named login.php. Don't change the filename to any name or else it will display a 404 error.


login.php



<?php

if (($_POST['Username'] == "Admin") and ($_POST['Password'] == "Password123"))
{
 echo "Welcome Admin or User.";
}
else
{
 echo "Wrong Username and Password, Try again.";
}

?>

Try it Your self!

Try to type the username Admin and the Password Password123. And click login. If it displays the welcome message you've type the correct username and password. Now try to type the wrong username and password. It will display a wrong password.

That's all

That all for today, If you have any questions, Please comment down below. Bye!

Using a custom mouse cursor using CSS

 If you can change the cursor on PC, how about it online. You dont need a .cur file. Using a image file works too. Here is how. 1. Creating ...