Chad,
Try something like this:
---------------------------------------------
<?
$qry = "SELECT category_id, category_name from tblCategories";
$result = mysql_query($query);
?>
<form method="POST" name="criteria" action="my_postpage.php">
<select name="categories">
<?
while ($category_array = mysql_fetch_array($result))
{
print "<OPTION
value=".category_array["category_id"].">
$category_array[category_name]</OPTION>";
}
?>
</select>
---------------------------------------------
Randy
-----Original Message-----
From: chad kellerman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 6:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] creating a drop down menu from mysql categories
Hello everyone,
I am a little new to the list. I have been reading a lot of the posts
but have not submitted yet. But I ran into a problem I was hoping I might
get e little help or at least get a point in the right direction.
I have a table called tblCategories with field category_ID with is
auto_incremented and another field called category_name.
I wish to have a drop down menu on an html page that is generated
automatically with Category_name as the option and the option
value=category_ID. It is going in a form which I submit and adds to a mysql
database. Everything is working fine except I cannot create the drop down
menu out of php. I would rather not have to edit my html page when ever I
add a category.
Is there any place I can look to see how someone else has accomplished
this? Or is there any specific function I should research in the php.net
manual pages? I have been looking but not too successfull.
thank you for any help you can offer.
-chad
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php