Login Registration form using PHP and MySQL | In this tutorial, you will learn how to make a Login Registration form using PHP and MySQL. Here, We will design the form by using HTML and CSS. Add the functionality by using PHP. We will connect it to the database, which is going to store the username, email, and password. We will apply validation and display the errors occurring during filling the form. If the user enters the correct username and password, we will redirect the user to the homepage. Here, the user can log out to get back to the login page.


  • register.php
  • login.php
  • server.php
  • style.css
  • home.php
  • errors.php
  • database: registration

First of all, Let me give a brief introduction of PHP and MySQL.

PHP stands for “PHP(Personal Home Page) Hypertext Preprocessor”. It is an open source server-side scripting language primarily designed for web development.

MySQL is an open-source relational database management system (RDBMS). Its name is a combination of “My”, the name of co-founder Michael Widenius’ daughter, and “SQL”, the abbreviation for Structured Query Language.

Related video


Open your PHP text editor. Click on File and choose the New option.  Save it as register.php.Here, we are going to make the registration form by using the HTML and CSS. The coding section is attached below.

<?php include('server.php'); ?>
<!DOCTYPE html>
  <link rel="stylesheet" type="text/css" href="style.css">


<form method=”post” action=”register.php”> <!– display validation errors here–> <?php include (‘errors.php’);?>

<br> <a href=”login.php”>Already have an account?</a> </form> </body> </html>

If you really liked the article, please subscribe to our YouTube Channel for videos related to this article.Please find us on Twitter and Facebook.

Related Posts