Forum Moderators: coopster

Message Too Old, No Replies

Reading Data from a Database for a Drop-Down Menu

         

Francis

7:32 am on Mar 27, 2005 (gmt 0)

10+ Year Member



Hi.
How can I possibly get existing data from a database to be used as menu items for a pull-down menu?

Primarily, I have a list of several products with different brands. I want this brands displayed as the menu items. There are several same brands on the database but different sub-products.

This is what I have now:

<form>
<select onChange=ChooseLink(this) name="select">
<option value=selected>Search by Category
<option value="<?php $_SERVER['DOCUMENT_ROOT']?>/products_display.php?category_id=Accessories">Accessories
<option value="<?php $_SERVER['DOCUMENT_ROOT']?>/products_display.php?category_id=Bookcase">Bookcase
:
:
:
</select>
<noscript>
<input type=submit value=Go name="submit">
</noscript>

Err, what if I have 300 Category? So I need to read from the CATEGORY field, and display them, and establish the link to PRODUCTS_DISPLAY.PHP

I think I have explained this as best as I could. For any clarifications, please reply.

Again, thanks for the help.

jamie

10:01 am on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi francis,

there's loads of tutorials out there explaining how to loop through database results to generate pull down menus.

have a search on google and try some out. post any errors you get back here.

good luck