Hi everybody, in my previous blog I show you how to create auto complete application in PHP using ajax and jQuery. Today I am talking about username availability checking and also email address availability checking using PHP, jQuery and Ajax. It is common application for every project. When a user want to register we have to check if username that the user is trying to use during registration process is already taken. Using Ajax, jQuery and PHP we can easily solve the problem. Lets start to build our application.

Step 1: Creating database table for username availability checking and insert some data
CREATE TABLE IF NOT EXISTS user_information (
username varchar(255) NOT NULL,
email varchar(255) NOT NULL,
password varchar(255) NOT NULL,
UNIQUE KEY email (email)

INSERT INTO user_information (id, username, email, password) VALUES
(1, ‘admin’, ‘admin@admin.com’, ‘12345’),
(2, ‘admin123’, ‘admin123@admin.com’, ‘12345’),
(3, ‘abhijit’, ‘abhijit@abhijitpal.in’, ‘12345’),
(4, ‘technokrats’, ‘info@technokrats.in’, ‘12345’),
(5, ‘seacom’, ‘seacom@gmail.com’, ‘12345’),
(6, ‘pratyush’, ‘pratyush@gmail.com’, ‘12345’);

Step2: Now we Creating our view file index.php. This file will show a html form.

Step 3: Create style.css for styling our view file

Step 4: Now create usernamevalid.js file. This file will take value from the form and using ajax we show the availability message to the user.

Step 5: Create the connection file conn.php to create php with mysql

Step 6: Create user_valid.php for username availability checking. This file receive the ajax post request for username and check if the username already exist or not


Spread the love
Username availability checking using Ajax
Tagged on:             
  • Bobby

    Quality articles is the main to attract the people to visit the web site, that’s what this site is

    • http://abhijitpal.in Abhijit

      Thank you

  • Kendra

    Greetings! Very helpful advice within this article! Many thanks for sharing!

    • http://abhijitpal.in Abhijit

      Thank you

  • Toniafortin

    This blog was… how do I say it? Relevant!! Finally I’ve found something which helped me.

  • maxcanchola

    Very good write-up. I absolutely love this site.
    Stick with it!