What is the proper code to build dynamic dropdown menus using PHP/MySQL?
I am trying to build a search page with dropdown menus dynamically build from the options in the table.
For example, I have over 800 records in a table with a field that is populated by 4 different colors. The field is obviously called 'color' and each record will have only one of 4 colors associated with it:
red, blue, green, yellow
I want to build a dynamic dropdown menu on the search page that will have only 4 options in the dropdown menu for color: red, blue, green, yellow.
No matter what I do, I get 800 colors listed in the dropdown menu.
I am trying to build a search page with dropdown menus dynamically build from the options in the table.
For example, I have over 800 records in a table with a field that is populated by 4 different colors. The field is obviously called 'color' and each record will have only one of 4 colors associated with it:
red, blue, green, yellow
I want to build a dynamic dropdown menu on the search page that will have only 4 options in the dropdown menu for color: red, blue, green, yellow.
No matter what I do, I get 800 colors listed in the dropdown menu.
Comment