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

Posted on 2009-04-16
Last Modified: 2013-12-12
how can i create dynamic menu and also on mouse over dynamic submenu in php
Question by:SCALERCODE
    LVL 3

    Accepted Solution

    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 ;-)
    LVL 36

    Assisted Solution

    by:Loganathan Natarajan
    LVL 3

    Assisted Solution

    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!
    LVL 10

    Assisted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now