Home » PHP » Ajax country state city dropdown using php & mysql
ajax country state city dropdown using php mysql

Ajax country state city dropdown using php & mysql

Hello friend this post is all about Daynamic Selection of Dropdown in php and Mysql using ajax and jquery. Country city and state dropdown mostly used in new registration of new user and etc.

  • This tutorial will explain you how to make Dependent dropdown of country, state, and city, using ajax. You will find them implemented in various sites registration  form.when the user select country then second dropdown will populate with appropriate  states list then city like wise..
  • This Tutorials load the record dynamically from the database according the user input. with ajax call without refreshing the whole page data will be populate.
  •  country state city Dropdown, using ajax and jqurey fill country state city dropdown.
  • ajax country state city dropdown php, onchange in jquery, dynamic dropdown.

Database & Tables

  • First of all open mysql and create one database dbcountries this database contains three tables country state and city as below. state table has relation with country table and city table has relation with state table.

Country State City tabel

Above are the three table the we use in this tutorials each table have three columns which are dependent to each other.


  • Simple Database Configuration file.


  1. main index file where three dropdown box are available.


  • This file is for get the all the state record from the state tabel and load dynamically.


  • In this file have php code for load correlated city according to state selection.
  •  all the main file are displayed remaining css and java script file include normally we do. It’s not big thing.
  • Depending on the dropdown ajax call the function and query should run and get the data from database and populate in dropdown list.
  • Loding image is indicate loding time of ajax function. When Query  response comes then login image invisible.

 Live Demo-:

ajax country state city dropdown using php mysql


Live Demo Download

About Bhavin Shiroya

Check Also


php login form, with mysql using jquery 2015.

How To Create php login form In Php with Mysql and Jqurey Now Day Php …

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.