I have two tables, one that contains a list of categories and the other is a list of inventory. I do not want to hard code categories into my forms.
I have created a form where I am able to add a category_name to a record in the inventory table. A list of category names are taken from the category table, below is the code I used to create a dropdown box for category names.
<p>Category:
<select name="category_name" size="1" value=http://www.phpbuilder.com/board/archive/index.php/"$category_name">
<?
while(list($category_number,$category_name) = mysql_fetch_row($sql_result)) {
print "<option value=\"$category_name\">$category_name</option>\n";
}
mysql_close();
?>
</select>
My question is, I have another form on another page where I update/ delete records on the inventory table and I want to be able to make changes to category_name. It seems like I can only display category_name from either the inventory or category table. I would like the default value in the dropdown box to be from the inventory table, but a list of options to change that value come from the category table. Is that possible? Any ideas?
Most of my forms have drop down boxes that are hard coded, which is a pain in the ..... when I have to make changes.
Thanks,
Jamie
I have created a form where I am able to add a category_name to a record in the inventory table. A list of category names are taken from the category table, below is the code I used to create a dropdown box for category names.
<p>Category:
<select name="category_name" size="1" value=http://www.phpbuilder.com/board/archive/index.php/"$category_name">
<?
while(list($category_number,$category_name) = mysql_fetch_row($sql_result)) {
print "<option value=\"$category_name\">$category_name</option>\n";
}
mysql_close();
?>
</select>
My question is, I have another form on another page where I update/ delete records on the inventory table and I want to be able to make changes to category_name. It seems like I can only display category_name from either the inventory or category table. I would like the default value in the dropdown box to be from the inventory table, but a list of options to change that value come from the category table. Is that possible? Any ideas?
Most of my forms have drop down boxes that are hard coded, which is a pain in the ..... when I have to make changes.
Thanks,
Jamie