Login Form Tutorials in PHP

0



Login Form Tutorials in PHP:-
1)First Create Table whose name will be admin and create userid and password field
 Insert Single row using the PHPMyAdmin Insert option.

2) Create a Login form design using login.php file
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Login Form</h1>
<form action="adminlogin.php" method="post">
<input type="text" name="txtuser" placeholder="Enter username" />
<br>
<br>
<input type="password" name="txtpass" placeholder="Enter password" />
<br>
<br>
<input type="submit" name="btnsubmit" value="Login" />
</form>
</body>
</html>
3) Create Code for login.php file
<?php
$user = $_REQUEST['txtuser'];
$pass = $_REQUEST['txtpass'];
$ram =mysqli_connect('localhost','root','','php12batch');
$res = mysqli_query($ram,"select * from admin where userid='$user' and password='$pass'");
if(mysqli_num_rows($res)>0)
{
header('location:index1.php');
}
else
{
echo "incorrect userid and password";
}
?> 
Tags

Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)