How to Create Login Form in PHP with MySQL Video Tutorial

0

Hey, Everybody, I hope you are all fine, in this tutorial, we will talk about How to Create a Login Form in PHP with MySQL.  Basically, Login Form plays the main role in signing in to the web application or desktop application. I have used many programming languages such as C#, Java, and PHP. So, I have designed and developed the form with the help of C#, Java, and PHP.

login-form-in-php

So, I will share with you how you can design a form in HTML5 and CSS3. After designing the Login form, then you will be able to use PHP to make a dynamic Login Form. I have made the login form in PHP with MySQL and also I have designed it.

Below, I have shared the complete source for the login form, you can download the complete source code on below. Furthermore, I have made a video tutorial on how you can Create a Login Form in PHP with MySQL. You can watch the video, then you can get more ideas on it.

How to Create Login Page in HTML and CSS3

First of All, you need to create a login page or form with help of HTML and CSS3. If you have knowledge in HTML and CSS3 and you will design a login form or page, that’s great. Otherwise, I have shared the codes and also a video tutorial.

You May Also Like: Login Page in PHP with Source Code

Here I have shared codes in HTML and Also Attached Stylesheet Links.

<!DOCTYPE html>
<html>
<head>
	<title> Login Form in HTML5 and CSS3</title>
	<link rel="stylesheet" a href="css\style.css">
	<link rel="stylesheet" a href="css\font-awesome.min.css">
</head>
<body>
	<div class="container">
	<img src="image/login.png"/>
		<form>
			<div class="form-input">
				<input type="text" name="text" placeholder="Enter the User Name"/>	
			</div>
			<div class="form-input">
				<input type="password" name="password" placeholder="password"/>
			</div>
			<input type="submit" type="submit" value="LOGIN" class="btn-login"/>
		</form>
	</div>
</body>
</html>

Above mentioned codes are all about Sign-in Form in HTML, you can copy it and paste it with personal code editors. Before running the form, you need to link the stylesheet codes.

Below I have shared CSS3 styling the Login Form, you need to copy it and paste it with the personal code editor and save them with the CSS3 extension.

body{
	margin: 0 auto;
	background-image: url("../image/technology.jpg");
	background-repeat: no-repeat;
	background-size: 100% 720px;
}

.container{
	width: 500px;
	height: 450px;
	text-align: center;
	margin: 0 auto;
	background-color: rgba(44, 62, 80,0.7);
	margin-top: 160px;
}

.container img{
	width: 150px;
	height: 150px;
	margin-top: -60px;
}

input[type="text"],input[type="password"]{
	margin-top: 30px;
	height: 45px;
	width: 300px;
	font-size: 18px;
	margin-bottom: 20px;
	background-color: #fff;
	padding-left: 40px;
}

.form-input::before{
	content: "\f007";
	font-family: "FontAwesome";
	padding-left: 07px;
	padding-top: 40px;
	position: absolute;
	font-size: 35px;
	color: #2980b9; 
}

.form-input:nth-child(2)::before{
	content: "\f023";
}

.btn-login{
	padding: 15px 25px;
	border: none;
	background-color: #27ae60;
	color: #fff;
}

However, Below I have shared the video tutorial to design login forms with the help of HTML5 and CSS3.

Now, After the design login form, you need to use PHP scripts. Below I have shared the PHP scripts, you can use it to make a complete project.

You May Also Like: Complaint Management System in PHP

<?php 

$host="localhost";
$user="root";
$password="";
$db="demo";

mysql_connect($host,$user,$password);
mysql_select_db($db);

if(isset($_POST['username'])){
    
    $uname=$_POST['username'];
    $password=$_POST['password'];
    
    $sql="select * from loginform where user='".$uname."'AND Pass='".$password."' limit 1";
    
    $result=mysql_query($sql);
    
    if(mysql_num_rows($result)==1){
        echo " You Have Successfully Logged in";
        exit();
    }
    else{
        echo " You Have Entered Incorrect Password";
        exit();
    }
        
}
?>

After using PHP scripts, your login form has been successfully created. But you need to create a database and change the database name in the PHP scripts, that’s it.

You May Also Like: Sales & Inventory Management System in PHP

However, I have shared the video tutorial, you can watch it. Then you will learn step by step with practically.

How to Create Login Form in PHP with MySQL

Thanks for Visiting and Watching the Complete video. I hope you have learned as well. Kindly, share on my content/course on social networks.

You May Also Like: School Management System in PHP

If you have any questions/suggestions about this topic, kindly submit a single comment or email me. I will reply with your answer for a maximum of 24 hours. Subscriber my Social Networks Pages and Email for getting updates. Thanks for the read and watch my video Tutorial.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.