Let's say you have a MySQL table named 'table' with a column named 'categories.' You want to populate a drop down list with entries in the category column, so first you need to grab the necessary data:
<?
$q = mysql_query("SELECT categories FROM table WHERE 1") or die (mysql_error());
?>
Basically you need to begin the code for the drop down box, then loop through all the query results, then end the drop down box. You can do it like this:
<select name="categories">
<?
while ($r = mysql_fetch_array($q)){
echo "<option value=\"$r['categories']\">$r['categories']</option>";
}
?>
</select>
So if you have a result with the value "foo", the resulting HTML will read:
<option value="foo">foo</option>