Does anyone know the best way / code to select data from a database ( one field ), and loop it through to display in a drop down menu?
<select name="locations"> <option value="testv">test</option> <option value="testv2">test2</option> </select>
assuming MySQL:
<select name="locations"> <? // db connection code here $result = mysql_query (SELECT field FROM table); while ($row = mysql_fetch_row ($result)) { echo '<option>' . $row[0]; } ?> </select>
thanks Devin, its actually pgsql that I'm trying to use.