Today, We want to share with you country state city drop down list in php mysql.In this post we will show you Responsive country,state,city dropdown values from the database without refresh page using Ajax and PHP, hear for 3 drop down of country,state,city, drop downs without refreshing the page. we will give you demo and example for implement.In this post, we will learn about Country State City Dynamic Dependent Dropdown Using Jquery In Codeigniter with an example.
Here, i will learn you how to populate country state city in dropdown list in php mysql using jquery ajax.
country state city drop down list in php
All the country, state, city data and their licensing is 100% free to use so you can use this all the data for any commercial as well as non commercial web or mobile applications.
Include JS files
config_database.php Page
SearchRegion.php Page
*/ #include database configuration file require_once('config_database.php'); $country_id = $_GET['country_id']; $districts_data=mysqli_query($connection,"SELECT * FROM district where country_id = $country_id ORDER BY district"); $districts = array(); while($district = mysqli_fetch_assoc($districts_data)){ array_push($districts, $district); } print_r(json_encode($districts)); ?>
SearchCity.php Page
*/ #here simple include mysql database configuration file require_once('config_database.php'); $district_id = $_GET['district_id']; $districts_data=mysqli_query($connection,"SELECT * FROM city where district_id = $district_id ORDER BY city"); $districts = array(); while($district = mysqli_fetch_assoc($districts_data)){ array_push($districts, $district); } print_r(json_encode($districts)); ?>
I hope you get an idea about country state city database in php.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.