Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 750
  • Last Modified:

how can i create dynamic menu and also on mouse over dynamic submenu in php

how can i create dynamic menu and also on mouse over dynamic submenu in php
4 Solutions
You could create a database with with a ref field (default 0) then all your inserts get a autoid which you pair the ref  field to and then you have your dynamic menu with submenu.

Run two MySQL calls where you select the all fields with ref=0 run your while loop and set up the main menu. Then inside the while loop you run another SQL where you select where ref=the autoid of the mainmenu. Run a new while loop and set up your submenu.

Hope it makes sence ;-)
Loganathan NatarajanLAMP DeveloperCommented:
This is quite a big question...

One with only php...(won't work with mouseover).

If you have dreamweaver, I would recommend using their Spry Widgets... very useful.  You can also google Spry horizontal/vertical menu's.

Have a table MENU and SUBMENU;  Use fields <id><label><link>  and  <id><parent_id><label><link> respectively.
Make sure you retrieve and load all values from the menu/submenu when the page loads (will save you a lot of coding and AJAX nightmares).

Similar to what QualitySoftwareDev said...
Loop through the tables and create menu's via by echoing the code to the browser.

Hope this set's you off in the right direction!
Chris GralikeSpecialistCommented:
Next to the fact all the comments above are pretty correct on their subject, I cant stop but wonder what you mean with "dynamic".

Could you be a bit more specific in terms of, where does the content of the menu come from? How is it maintained?

Also please take note of the fact that PHP is a "Pre" hypertext processor. This means that PHP can handle what we like to call "Business Logic or Application Logic". It doesnt handle the actual "Look and Feel".

In functional terms this means that PHP can help you "Fetch and Generate" the content and needed HTML to create a menu. The way the menu itself acts in the browser is determined by other elements like CSS, AJAX, JScript etc.


Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now