Dynamic Dropdowns in PHP
When developing a simple web application for a client recently I had to include a dropdown list box on an input form to allow the user to choose a specific location. I wanted to make the application as flexible for future development as possible So rather than hardcode the list into HTML I created a table in a MySQL database. This allows the client to add new locations when they require and have the list automatically refresh with those changes. The code is I used is as follows:
Just copy and paste the above code into your PHP document and change the variables to suit.