Jump to content

[solved]dynamic pull down...


dpabla

Recommended Posts

IF any noob wants to know how to simply grab data from your mysql table and generate a pull down with the contents...here ya go

[code]
<?php

$result = mysql_query
("SELECT product_name,subcategory_id FROM products
WHERE subcategory_id = {$_GET['sub_id']}");

// printing the list box select command

echo "<div align=center><select name=collection value=''><option value=''>Browse Collection</option><br>";

// Array or records stored in variable named $collection

while($collection=mysql_fetch_array($result)){
$prodname = $collection["product_name"];

// Option values are added by looping through the array

echo "<option value='".$prodname."'>".$prodname."</option>";

// Closing of list box

}

echo "</select>";



?>

[/code]
Link to comment
https://forums.phpfreaks.com/topic/33129-solveddynamic-pull-down/
Share on other sites

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.