Complete User Registration System in PHP MySQL Login System
Form validation source code download

Overview

This tutorial is a follow up to our previous tutorial Secure Login System with PHP and MySQL. In this tutorial, we'll be creating a secure registration form and implementing basic validation.


A registration form is what your website's visitors can use to register their details, which will subsequently be stored in a MySQL database and be used for authentication purposes.


The Advanced package includes additional features and a download link to the source code. In addition, it includes the complete tutorial source code.

Source code download link at the end of this page

Contents

XAMPP Installation

Before starting we need to install XAMPP software that helps to create a database. You can download the XAMPP appache server from this link - Downlaod XAMPP.
After installation just start the appache server and mysql server, below is the example

xamp server start process

Designing the registration form

After the installation of XAMPP we will create the login form and signup form using HTML CSS and Javascript. You can create a basic form that should contains some required fields eg; name, email, username, password


Login Form;

To create a login form we will add only two fields eg; Email or username and Password is the mandatory.

and in the form tag we will use POST method and action will be your main file (login_register.php)

In the input tags we need to add name=full_name and for password name = password and like-wise for login button name=login


Signup Form;

To create a Signup form we will add multiple fields eg; name, Email and username and Password

and in the form tag we will use POST method and action will be your main file (login_register.php)

In the input tags we need to add name=full_name and for password name = password and like-wise for signup button name=signup

login signup form img

Connection.php

Now we need to connect the database to our file. To connect our database we need to create a new file called Connection.php


The below code we need to add in the connection.php file.

connection.php code

Login_register.php

This file is very important.

In this file we will create a function that will check the user login or signup.

First we need to write code for signup. So, for this first we will check from our database if the user is already exist or not, the below code helps us to fetch this data


if(isset($_POST['register']))
{ $user_exist_query="SELECT * FROM `registered_users` WHERE `username`='$_POST[username]' OR `email`='$_POST[email]'";
$result=mysqli_query($con,$user_exist_query);
                    

If there is no previous user stored in the database with the current username or email then we will allow user to create accout further

If the user is already exist then we will show the error message to the user.

The below code we will use to do it

signup result for form validation

PHP Mailer Library

Now we will add email verification to our form. When user clicks on Signup button, then user should receive an email to verify that mentioned email belongs to th respective user.

So to do it, we will use PHP Mialer library. PHP Mailer Library helps us to send an email through our gmail.

To download this library click on the below link and install the zip file and after installion add the library in the php file. Download here

After download the files export and import the files to your vs code


Download the source code here and watch-out the Video for better understanding

download here



Suggested posts as per your recent activity

Download the INSTAGRAM CLONE







Questions covered in this article

1. How to make a registration system in PHP?

2. How to create registration form in HTML with database?

3. How to create user registration form in ASP.NET using SQL Server database with source code?

4. How to connect database in PHP registration form?







Related Searches

Mysql user registration system source code

Mysql user registration system source code

User registration system source code java

User registration system source code php

User registration system source code github

User registration system source code example

simple registration form in php source code

login and registration form in php source code

student registration form in php source code