I have 2 drop down lists on my homepage:
- To firstly let the user select the 'County'
- To secondly let the user select the 'Town'- related to that County'
The town is related to the County by relating the County's Name and the Town's Name.
What I want to be able to do is:
Once the visitor selects the 'County' some way, the second开发者_运维知识库 Drop Down refreshes only to reveal the towns that are related to the County within the database.
I would appreciate any help and coding examples for the SQL Queries and Refreshes etc..
Many thanks,
Javascript
Assuming that you have a CGI responsible for retrieve the data, you have the following workflow:
- The only visible dropdown list is the first one.
- When the user chooses the "county" you send a request to the CGI with the first value to retrieve all the possible "Tows".
- Then you populate your second dropdown list with the CGI answer and show it to the user.
CGI
It is not possible to show you the right query because I don't know your database. By the way, do you have any database? That is certainly the hard part (at least in my country it is hard to find one).
精彩评论