Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

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";
}



?> 



Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post