how-to-make-login-form-in-php

Steps to Create User Login Form in PHP and MySQLi

how-to-make-login-form-in-php
how-to-make-login-form-in-php

Process Field:

  1. Create a Database
  2. Create a Database Table with Following Five Fields: id, username, email, password, trn_date.
  3. Create a Login Form.
  4. Connect to the Database by using PHP.
  5. Authenticate Logged in User.
  6. Create Index Page.
  7. Create Dashboard Page.
  8. Create a Log Out.
  9. Create a CSS File.

Login.php

<div class="container">
                <div class="signin-content">
                    <div class="signin-image">
                        <figure><img src="images/signin-image.jpg" alt="sing up image"></figure>
                        <a href="signup.php" class="signup-image-link">Apply Now</a>
						<a href="forget-password.php" class="signup-image-link">Forget Password</a>
                    </div>
                    
                    <div class="signin-form">
                        <h2 class="form-title">Login</h2>
						
                        <form method="POST" class="register-form" id="login-form" action="">
                            <div class="form-group">
                                <label for="your_name"><i class="zmdi zmdi-account material-icons-name"></i></label>
                                <input type="email" name="email" id="email_id" placeholder="Email ID" autocomplete="on" required />
                            </div>
                            <div class="form-group">
                                <label for="your_pass"><i class="zmdi zmdi-lock"></i></label>
                                <input type="password" name="password" id="pass" placeholder="Password" required/>
                            </div>
                            
                            <div class="form-group form-button">
                                <input type="submit" name="submit" id="signin" class="form-submit" value="Log in"/>
                            </div>
                        </form>
                       
                    </div>
                </div>
            </div>

conn.php

<?php

$servername="localhost";
$serveruser="root";
$serverpass="";
$db="cspwebsite";

$con=mysqli_connect($servername,$serveruser,$serverpass,$db);
if(!$con)
{
  echo "failed";
}
?>