Jump to content

Pulling a drop down list from a product table


tomfmason

Recommended Posts

Making some assumptions about your table name and column names in your db, this should do it.


[code]<select id="productnames" NAME="productnames">
<?
$result = mysql_query ("SELECT productnames FROM producttable")
  or die ("Query failed");
while($row=mysql_fetch_array($result)){
    echo '<option value="' . $row['productname'] . '">' . $row['productname'] . "</option>\n";
}
?>
</select></P></TD>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.