SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic Drop Down Menu

    Hello. I've searched the web trying to solve this problem and I haven't been able to figure it out. I am trying to create a menu where a list of car makes are pulled from a database so one can be selected in a form and then the list of models for the car make selected will be available as an option. I have the database made. The first table is title category and it has a cat_id number with the values being the car makes. The second table is titled subcategory and it lists the car models. The column titled cat_id in this table matches the number in the category table where the makes are stored.

    Here is a sample image of the database:
    Screen shot 2012-01-30 at 10.17.09 AM.pngScreen shot 2012-01-30 at 10.18.30 AM.png

  2. #2
    Non-Member
    Join Date
    Jan 2012
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After the user selects a car make, run a sql query joining the 2 tables on cat_id for the selected make to get the models for that make. The use a WHILE loop to loop through the query's result set to output the car model options.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •