I need a script using Ajax, PHP and mySQL that populates a drop-down list using data from mySQL. MySQL contains categories and when a category is selected it runs a query (using Ajax) against another table 'subcategories' to see if the category selected has a subcategory. If it does then another drop-doen appears and is popluated with the list of sub categories. If there are no subcategories then nothing happens.
So there are 2 tables, 'categories' and 'subcategories'.
Categories has columns: id, category
Subcategories has colums: id, category, subcategory
the 'id' column in categories matches the 'category' column in the subcategories table.