Check Username Availability Using Ajax + PHP+Mysqli

This post all about Check username availability using ajax PHP mysqli. checking username is very popular functionality in e-commerce, social networking websites, insurance, and banking applications. To make a user unique or his identity on this application it requires a username. At the time of the registration, the application will ask to provide username and password, so in that time when the user enters the username, the application should be validated from database uniqueness of users.

Check username availability using ajax php mysqli

Now the question is how to check the username is exist or not in the database without form submit?
So to perform this functionality without a page refresh, we can use Ajax.

Here I have given a below example for check username availability using ajax. you can try the demo by entering the user name “admin” or “Rebecca” as not available and all other as available.

Here also we have some disable and enable registration button for valid username. until username is valid that register button will disable then getting the valid username you can see register button will enable. One more important validation is like same as email id. The same way you can check the email Id is existing or not in the database by using the same function. Below example, you are sending the username to ajax page by POST method and in ajax page that checking whether that username or email exists or not, if yes it will return a true value else returns a false value. based on that will can show the error message in the success section in ajax response. the same way you can send an email if you want to check email is exist or not in mysqli database.

Step-1 Database:

Step-2 index.php

Step-3 check_user.php


Also Read:

Check Email ID exists using ajax php mysqli

Download the source code:

Click here to download


Tags: , , , ,