hey, guys. I have a problem with chained selectors for the web page.
The idea is to make the 3 select boxes that will dynamically populate based on the value of the previous one. The first populates the second and the second populates the third.
I have District, Town/Village and Location. I have found the easy way to do 2, but with three it becomes a little bit messed up and confusing.
I have three tables in my sql, the first table is the District, second is the Town and the third is the Location. The structure of the tables is following:
District
ID
Name
Town
ID
District
Name
Location
ID
District
Town
Location
I was making the query by selecting the location properties with WHERE, then I was making the query with JOIN.
The point was to extract the results of the query into the array, and then use it with javascript, in order to update it dynamically on the page, but I got lost in the syntax, how exactly to declare those arrays and how to pass the values to that arrays.
Thanks to anyone who can help
php chained selectors
Moderator: General Moderators
ok, the ID in each table is just the record counter, the relations are the the following:
Name in the district is refered to District in the Town table and the Name in the Town table is refered to the Town in the District table.
No foreign keys, maybe not the best way to do it...
so, if you have, for example, two districts the the District table, District1 and District2, lets say, in the Town table its going to be Distirct1 | Town1, District1 | Town2, District 2 | Town1, District2 | Town2 and so on...
Then in the location table its going to be Distirct1 | Town1 | Location1, Distirct1 | Town1 | Location2 etc...
Name in the district is refered to District in the Town table and the Name in the Town table is refered to the Town in the District table.
No foreign keys, maybe not the best way to do it...
so, if you have, for example, two districts the the District table, District1 and District2, lets say, in the Town table its going to be Distirct1 | Town1, District1 | Town2, District 2 | Town1, District2 | Town2 and so on...
Then in the location table its going to be Distirct1 | Town1 | Location1, Distirct1 | Town1 | Location2 etc...