Login page in php ,mysql using using html form (source code)
Login page in php ,mysql using using html form
The source code of login page in html using php and mysql connection is given below.
<?php
session_start();
include("connection.php");
?>
<form acion="" method="POST">
Username: <input type="text" name="username" value=""/><br><br>
Password: <input type="password" name="password" value=""/><br><br>
<input type="submit" name="submit" value="login"/>
</form>
<?php
if(isset($_POST['submit']))
{
$user=$_POST['username'];
$pwd=$_POST['password'];
$query="SELECT *FROM STUDENT WHERE username='$user' && password='$pwd'";
$data=mysqli_query($conn,$query);
$total=mysqli_num_rows($data);
if( $total==1)
{ $_SESSION['user_name']=$user;
header('location:home.php');
}
else{
echo "login failed";
}
}
?>
Comments
Post a Comment