Category SubCategories and two MySQL tables
I have two MySQL tables, for example:
id category sub_id subcategory cat_id
1 house 10 bird 2
2 animal 20 cat 2
30 dog 2
40 fence 1
50 gate 1
60 horse 2
and so on.
I would think to get the info from the two tables I would use a statement such as:
"SELECT id, category, sub_id, subcategory, cat_id FROM products,sub_products";
Once I have the data, I only want the user to select one category from a drop list field and display the matching sub-category drop list in another field, for example:
Category ......... house ........ animal
SubCategory ... gate ... dog
... fence ... cat
... roof ... bird
... steps ... horse
Is it possible to do this with PHP using two MySQL tables within plain HTML?
I have seen a number of solutions requiring the category and sub-categories to be entered as options within the PHP code, but this is impractical as I could use up to 100 categorys and 1000 subcategories.
Thanks for any assistance.