Jump to content

Archived

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

tomfmason

Pulling a drop down list from a product table

Recommended Posts

I am wondering how I can print product names, from a product table, into a drop down menu? Any suggestions would be greatly apperciated.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

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.