> Online tutorial : login form using php
Showing posts with label login form using php. Show all posts
Showing posts with label login form using php. Show all posts

login form using php

Login form using php
Now we are going to create login form by using PHP validation technique.now we are create database for the login called Login
then we can use the database .
Then we are simple HTML form for get user name and password from the system
Program


<html>
<body>


<form name='form1' method="post" action="logo.php">
    <table width='200' height='300' border='1'>
User Name <input type='text' name='name' placeholder='Enter user name' size='15'><br/>    <br/>

Password<input type='password' name='pass' size='15' placeholder='Password'><br/>              <br/>
</table>

<input type='submit' value='Login'>
</form></body></html>

Output









Now we are going to create PHP form for validation
Program

<?php
$conn=mysql_connect("localhost","root","");
$sel=mysql_select_db("login",$conn);
$name=$_POST['name'];
$pass=$_POST['pass'];
$check=mysql_query("select * from logdata where name='$name' and pass='$pass'");
$count=mysql_num_rows($check);
if($count == 1)
{
    echo "Login ";

}
else
{
    echo "failed";
}
?>



Output

If the given data are correct then following output will produced