For an easier way to generate HTML elements such as tables, listboxes, drop down listboxes, multi select listboxes and more check out the FormattedDataSet (
http://www.fdsapi.com).
It is as easy as the following coe. Note that the drop down list box code highlights the selected value too.
The site has a live demo that allows you to type in queries and another that creates standard html elements such as list boxes off of 2 dimensional arrays (another supported datatype, but it would work the same for ResultSets or queries too).