Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7403779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:09:33+00:00 2026-05-29T05:09:33+00:00

I have these four tables (which are hierarchical, meanwhile) in my database: Table 1:

  • 0

I have these four tables (which are hierarchical, meanwhile) in my database:

Table 1: State

+----------+-------------+
| state_id | state_name  |
+----------+-------------+
|        1 | Maharashtra |
|        2 | Goa         |
+----------+-------------+

Table 2: District

+-------------+---------------+----------+
| district_id | district_name | state_id |
+-------------+---------------+----------+
|           1 | Mumbai        |        1 |
|           2 | Pune          |        1 |
|           3 | Nashik        |        1 |
|           4 | Aurangabad    |        1 |
|           5 | Panjim        |        2 |
|           6 | Dandeli       |        2 |
|           7 | Karwar        |        2 |
+-------------+---------------+----------+

Table 3: Taluka

+-----------+-------------+-------------+
| taluka_id | taluka_name | district_id |
+-----------+-------------+-------------+
|         1 | Alibag      |           1 |
|         2 | Kalyan      |           1 |
|         3 | Matheran    |           1 |
|         4 | Vaijapur    |           4 |
|         5 | Gangapur    |           4 |
|         6 | Kannad      |           4 |
|         7 | Sillod      |           4 |
|         8 | Madgaon     |           5 |
|         9 | Vengurle    |           5 |
|        10 | Sawantwadi  |           5 |
+-----------+-------------+-------------+

Table 4: Village

+------------+--------------+-----------+
| village_id | village_name | taluka_id |
+------------+--------------+-----------+
|          1 | Ranjangaon   |         5 |
|          2 | Wadgaon      |         5 |
|          3 | Teesgaon     |         5 |
+------------+--------------+-----------+

How could I show select boxes dynamically loaded while happening of following events:

  • Display select box for state names from “State” table
    • Here, state_id as value of <option> tag and state_name as text between opening and closing <option> tags)
  • On selecting any of the state from first select box for states, display a newly created select box for district names from “District” table relative to selected state option from first select box
    • Here, district_id as value of <option> tag and district_name as text between opening and closing <option> tags
  • Similary create a new select box for Talukas under selected District from second select box.
  • Once again, similary create a new select box for Villages under selected Taluka from third select box.

In the above manner, when going through selecting one by one values from newly created select boxes (which we may call children of parent/root select boxes), we finally would have four select boxes for viz. State, District, Taluka, Village.

The aim behind this process is that I need to get the village_id of specific Village along with other data like it’s state_id, district_id, and taluka_id.

Please provide an easy to use and flexible solution strictly using jQuery + AJAX, MySQL, PHP.

FYI, I have succeeded to populate select boxes for States and Districts using jQuery’s ajax method to POST value of changed select box asynchronously to a query containing PHP script. Well, this worked until I get second select box for Districts. This select box for Districts is created by DOM manipulation rather by server using jQuery, so I couldn’t check for change event on Districts’ select box so as to POST it’s selected value via AJAX to a MySQL query containing PHP script which queries Database for specific District and returns relative Talukas. Can it be handled using bind, delegate or live event handlers, huh–I don’t know!!! 😛


Well, my logic must be totally wrong. Just forget it, and please give me a complete solution. I will learn many things from that solution.
Thank you for reading this all disgust, by the way! 😉


I have created a prototype design for this. This should help to describe the question in visual way (or exactly what I wanted as output or solution to be):

"Prototype design for describing question"



UPDATE: Working demo code is available here: https://github.com/vishaltelangre/select-chain

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:09:34+00:00Added an answer on May 29, 2026 at 5:09 am
    1. Show a dropdown using State table. state_id will be option value and state_name will be text.
    2. When onchange event fires on this dropdown get the value of selected option.
    3. Send an Ajax call to load district for selected state. The parameter will be state_id
    4. In the PHP end get all the rows from District that with matching state_id. Return it as JSON response
    5. When Ajax get the response, create a new dropdown or populate previously created one with this new result.
    6. Go to Step 1 for District then Taluka then Village
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have four tables each with its own form, all these table share same
I have these four tables: feeds, feed_entries, entries_categorias and categorias. Whith these structures: CREATE
I have some SQL similar to the following, which joins four tables and then
I have a Projects table, which lists the client info. Then I have four
I have a table with four columns, of which one is <type> . I
I have four JTables which for the user looks like one table. (Why four
I have four groups of tables: Group A : tables which are queried only
So I have four tables. Each table has a single id for the previous
i have a table named record which contains four column branch,account,name,month. now i want
I have a Database named CarsType.accdb there are four fields in the data base

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.