mauro
mauro

Reputation: 127

php listing category

I have a email booking form whit 3 type of category's, and in each of theme there is 3

packages to select, when i select a category in my select list menu, should appear in the bottom

the other select list menu with his related packages of the category.

What is the best way to make this?

Upvotes: 0

Views: 79

Answers (1)

Jon Taylor
Jon Taylor

Reputation: 7905

Either store the related packages in a data structure that you can lookup on demand in javascript, this way when you switch the first drop down box, you can use the onchange to call a method that updates the contents of the second.

Or use an ajax query to get the information for a particular category and populate when onchange is called.

I would prefer the first method for small lists that are not going to change often, if the list is likely to change though dynamically (based on a database for example) and/or there are large quantities of categories/packages then I would go with the ajax approach.

Upvotes: 1

Related Questions