www.webdeveloper.com
Results 1 to 3 of 3

Thread: Build a dynamic mega drop down menu using php

  1. #1
    Join Date
    Jul 2013
    Posts
    1

    Build a dynamic mega drop down menu using php

    I'm Anil kumar i want to build a dynamic mega drop down menu using PHP.

    how to create table structure?

    how to write the code for doing this?

    please help me.

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    859
    Usually you start by writing something and then showing us. Then we help you correct it.

  3. #3
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    I agree with Gin.. But to try to answer your question...

    if what your asking is how to build a navigation bar with drop down links with php.

    1. Build the navbar with drown down link linking to what ever page you want.

    2. create each page you want and then create a variable at the top of each page using php. something like this at the top of each page
    <?php $page = 'home'; ?>


    3. create a nav bar in a page called nav.php that is basically a navigation bar using else and if statements in order to call on what link is active by referencing the variable for each page you have assigned. it will look like this.

    Code:
     <ul>
    <?php if ($page == 'home') { ?><li class="active"><a href="index.php" class="active">Home</a></li>
    <?php } else { ?><li><a href="index.php">Home</a><?php } ?>
    
    <?php if ($page == 'contact') { ?><li class="active"><a href="contact.php" class="active">Contact Us</a></li>
    <?php } else { ?><li><a href="contact.php">Contact Us</a><?php } ?>
    
    <?php if ($page == 'services') { ?><li class="active"><a href="services.php" class="active">Services</a></li>
    <?php } else { ?><li><a href="services.php">Services</a><?php } ?>
    
    <?php if ($page == 'employees') { ?><li class="active"><a href="employees.php" class="active">Employees</a></li>
    <?php } else { ?><li><a href="employees.php">Employees</a><?php } ?>
    
    <?php if ($page == 'dashboard') { ?><li class="active"><a href="dashboard.php" class="active">Dashboard</a></li>
    <?php } else { ?><li><a href="dashboard.php">Dashboard</a><?php } ?>
    </ul>
    now no matter what page your own the php with identify it by recognizing the variable you have set and then you can use css to do things with the nav bar to make it super duper doooooo

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles