Skip to content
Advertisement

how to Display dynamic dropdown using table data

I need to show state depending on country selected from drop down. It uses the table data to fetch and find the related data using AJAX

Here is my HTML markup

JavaScript

This is my javascript code to post the option value to action.php page

JavaScript

This is my action.php page

JavaScript

?>

The state doesn’t appear in my drop down and shows this error i have attached the screenshot here.

I use alert to find what happens here it throws this error.

This image shows the drop down error  have found

This is my Sql file

JavaScript

Advertisement

Answer

Finally I found a solution for Displaying dynamic drop down with MYSQL table text data.

My AJAX library CDN (it needs to place in footer position)

JavaScript

My Database configuration code config.php

JavaScript

?>

My HTML and PHP code to display Drop Down

JavaScript

My java script code to post the option value to filter the district using AJAX.here i post the data to get_district.PHP page.

JavaScript

My get_district.php code

JavaScript

?>

Here is my sql file

JavaScript

I actually found this solution here

Thanks a lot… 🙂

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement