Live Username Availability using PHP & jQuery

In this tutorial, 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.

Step 1: Create table to store username into database.

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

Step 3: Created layout file index.php and added html element to create login view.

Step 4: Let’s create a javascript method to get data from above html input box and validate with Ajax request, this method will be call on keyup event of input box. We are checking the username against the database on keyup. We’re making a unique request on each time keyup. We ll add below code into the index.php.

Step 5: Let’s create a file 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