Sharp Tutorial
login page example in php

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

PHP Introduction

  • PHP home
  • PHP introduction
  • How to install and run
  • Syntax and Rule in PHP
  • Data type and operator
  • If else in php
  • Loop in php
  • Array in php
  • Sring in php
  • Function in php
  • Include in php

Working with Forms

  • Get and Post
  • Get Form input into PHP
  • Form Validation

PHP with MySQl

  • Connect PHP & Mysql
  • Insert using PHP Mysql
  • Select using PHP MySql
  • Delete Update using PHP Mysql
  • Login Page Example in PHP

Advanced PHP

  • Session in PHP
  • Cookies in PHP
  • File Handling in PHP
  • File Upload/Download PH

Object Oriented PHP

  • Class Obejct in PHP
  • Constructor in PHP
  • Destructor in PHP
  • Inheritance in PHP

login page example in php

Login page example using html form and php in this example we check if user is valid or not.

Login HTML Page

<html>
<body bgcolor="gray">
<center>
<form name="loginform" action="loginpage.php" method="post">
UserName<input type="text" name="username"><br>
Password<input type="password" name="pass"><br>
<input type="submit" name="btn" value="login">
<input type="reset" name="btn" value="cancel">
</form>
</center>
</body>
</html>

Login PHP Page

<html>
 <body bgcolor="gray">
 <center>
 <?php
  $host="localhost";
  $dbuser = "root";
  $password = ""; // change password as per your database.
  $dbname=     "sharp_tutorial";
  $conn = mysqli_connect($host, $dbuser, $password,$dbname);
  $username=$_POST['username'];
  $pass=$_POST['pass'];
  $query=" select * from login where userid='$username' and password='$pass' ";
  $data=mysqli_query($conn,$query);
  if(mysqli_num_rows($data) > 0) {
  echo "Valid User";
  }
  else
  echo "Not Valid user";	  
?>
<center></body>
</html>

If userid and password entered correct then valid user message is these otherwise not valid user message is printed.

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial