Forum Moderators: coopster

Message Too Old, No Replies

mysql php and menus

         

bagheera

8:16 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



I have maybe a simple problem. I would like a rollover menu that would work like:

Tools
> drillers
> hammers
> screws
etc.
...

But I would like the menu to be filled up dynamically (as I enter my DB table for the Tools) so I do not need to update the html page.

How can I get the tools types to be reflected in the menu?

Do I need to call some js while looping through or...?

Im not good at js.

Any adivce would make my day better,
thanks

Serap

Salsa

8:51 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



You can use PHP to query your database and create arrays that a Javascipt function can use, like:

$JS_drills_options = "var drills = new Array(";

...then loop through the results of your query to concatenate on all the appropriate array members... etc.

But to actually use the arrays in a client side options swap, the Javascript [webmasterworld.com] forum is the place ask.

I hope this helps.

Salsa

9:59 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



I may have misunderstood you. If you only need one options menu--not needing the selection in one menu to affect the contents of a second options menu, you can easily do it all in php.

If so, this post from a couple of weeks ago may help: Drop down box values from table field? [webmasterworld.com]

bagheera

11:39 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



Thanks for your answers, actually I know how to get the options in a drop-down (which I think your previous post is about), but I do not know how to have them in a menu-bar at the top of the page. So that when I make a mouse-over my options are displayed.....an yes it is only one level...

thanks,
Serap

Salsa

11:56 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



Ah. Well, that will be mostly Javascript, but you can use PHP to build the necessary Javascript funtion(s), so the menus remain current with your database. Here's a thread [webmasterworld.com] that is, again, about building option lists, but the scheme is similar to what you might need.