Live Username Availability using PHP & jQuery

In This Post,We will learn how to implement username live check availability feature using PHP, jQuery and MySQL.We will send AJAX request to server-side script(PHP) and get response from ajax request as a JSON object.We will show success/error message if the user name available/exists or validation type error.Its very useful when you are checking username availability on live form from database.

This functionality important when you are providing username availability on live enter of username.

live_Username_Availability

Step 1: Create table to store username into database.

Step 2: Created database connection file connection.php, to connect mysql to php.

Step 3: Index.phpCreated layout file.

Step 4: Index.php
We will create java script method to get data from input box and validate with Ajax request, this method call on keyup event of input box. We are checking the username against the database on keyup we’re making a unique request each time.

Step 5: PHP Code – check.php
We will get Ajax request in this file send the appropriate message according request parameters.
If the user is entering valid username then we will display success message otherwise we will send error message.

Live Demo & Download Code

  • ben

    Hi,

    This code looks good but where is the database connection?

    Thanks,

    Ben

    • Hi Ben,
      I had assumed , User has database connection layer.