10

6 Steps to Create Simple User Registration Script in PHP and MySql

This is a Simple User Registration Script in PHP and MySQL. By using this user can easily register, filling username, email, password fields. After submitting form, the data will be stored in a database table. So that next time user can login with the login credentials which are used while user registration.

Here these are a series of articles

These scripts are for beginner learners, who want to learn the concept of user registration, login, login activation and forgot password.

  1. Simple User Registration Script in PHP and MySQL
  2. Simple Login Script in PHP and MySQL
  3. User Login with activation check using PHP and MySQL
  4. Send Forgotten Password by mail using PHP and MySQL

Steps to creating Simple User Registration Script in PHP and MySql

  1. Create a database
  2. Creating table with five fields
    • id
    • username
    • email
    • password
    • active
  3. Create form in html
  4. Adding styles to form
  5. Connect to the database using php
  6. Writing logic for user registration script in php

Below is the My Video on User Login, Registration Script in PHP & MySQL

Buy My Complete Video Course at $19 Instead $120

More than 3000+ stdents Joined, It’s 5 star rated course.

You can get My complete video course with all project files for as low as $19 only 10 coupons available

If you missed the above offer, you can use these below offers.

Access for $29 only 20 coupons available

Access for $39 only 50 coupons available

Hurry!! If these coupons runs out, you have to get this course at full price $120.

1. Create a Database

For creating a database, login to phpmyadmin, then click on Databases tab. And in the input field enter database name and click on create database button.

2. Creating a Database table

After creating Database, Create a database table for users, it’s simple table with user name, email, password, active and an id as primary key and also it is auto incremented.

  • id is the primary key and auto incremented.
  • Username field will be used for storing username
  • email field will be used for storing email address of user, this will be used to send forgotten password by email  in this series.
  • Password field will store password of user in normal format.
  • active state is for checking the user is active or blocked user, If the user is blocked then he can’t login to system.

Import this below sql into your database.

3. Create form in html

Save this file as register.php, Here this is simple html for generating form. This form contains user name field, email, password a submit button and a link to login.php file. Here i’m adding some classes to the HTML, Later i can add some styles.

4. Adding styles to form

Here i’ve added some styles to form, so that it will look good. I’m using Bootstrap with some custom styles.

Put this code in head section of register.php file

Save this code as styles.css file

5. Connect to the database

Create a file with name connect.php. Here i’m connecting to database and selecting the database.

User correct database name & user credentials.

6. Writing logic for user registration script in php

All the registration process done in one single php file, in this file we will display an html form for user to register. In the PHP section we will first connect to the database, then we will select the database, if the values are posted, then we are running a MySQL query it will insert the values into the database.

Add this code register.php file above the html code. That means right before step 3 code. If you have any dobut, you can check the final code.

Add this code after opening form tag, this code is used to display the status message.

Complete Code of Register.php

If you want to learn other things you can read other posts – registration, login, user login with activation check, and sending forgotten password by email .

I hope this article helped you to learn user registration using PHP and MySQL . To get latest news and updates follow us on twitter & facebook, subscribe to newsletter. If you have any feedback please let us know by using comment form.

Buy My Complete Video Course at $19 Instead $120

More than 3000+ stdents Joined, It’s 5 star rated course.

You can get My complete video course with all project files for as low as $19 only 10 coupons available

If you missed the above offer, you can use these below offers.

Access for $29 only 20 coupons available

Access for $39 only 50 coupons available

Hurry!! If these coupons runs out, you have to get this course at full price $120.

Incoming search terms:

  • registration form in php
  • PHP registration script
  • simple registration form in php
  • php code for registration form
  • php registration form
  • php register script
  • php code for registration
  • php signup script
  • user registration form in php
  • php coding for registration form
Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 10 comments
Balaji

You there step no 6 file name what ? what can be save that file

Reply
Azams

IMHO, using mysqli extension is better than mysql ext. but thanks for this good tutorial. 🙂

Reply
Elena Calvillo

THANK YOU SO MUCH!, I understand better this subject now =)

Reply
Rajneesh

I have been reading tons of blogs regarding this, but i was not satisfied. Thanks to the author and thanks to codingcyber:)

Reply
Prakash

Simple and clean php steps here. Thank you so much!

Reply
Saurabh Prakash

Your post is just awesome sir
I also tried so much to make a login and registration system

Thanks u so much and your one is just awesome

Reply
Andrade

<
<

I don't where to write d above code in d form opening tag. Pls i need some help writing it.

Reply
    Vivek Vengala

    Hi Andrade,

    Please put the code in same file above HTML opening tag, or else you can unlock the complete code and save it in a file.

    Let me know, if you still have any problem.

    Reply
sujata

Hi sir,
This is sujata,i want to know what is code of Registration form and how to connect to that with database.plz let me know
Thanks&regards
sujata

Reply
    Vivek Vengala

    Hello Sujata,

    You can watch my video series to understand about this.

    If you have any questions let me know…

    Reply

Leave a Reply:

x

Join My Facebook Group to Receive Coding Tutorial for Free

email-subsribe