Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:59:11+00:00 2026-05-23T12:59:11+00:00

I am currently designing a vertical drop menu (with submenus), here’s how it looks:

  • 0

I am currently designing a vertical drop menu (with submenus), here’s how it looks:

Click here to see the screenshot

On the left, no menu item is selected.
On the middle and on the right there are sub-menus opened (and the selected page in blue).
One sub-menu can be opened at once (one opens => the other closes).
The contents of the menu is not dynamic.

The big problem was that when i opened a new page, the sub-menu of the selected page had to be opened.

So I decided that all my pages links will be like index.php?p=my_selected_page and in a file menu.php I built this array:

$menu = array(
    'Présentation' => array(
        'accueil' => 'Accueil',
        'inscription' => 'Inscrivez-vous'
    ),
    'Nos actions' => array(
        'mediation-familiale' => 'Médiation familiale',
        'droit-de-visite' => 'Droit de visite accompagnée',
        'accompagnement-familial' => 'Accompagnement familial'
    )
    // [...]
);

Then I get the page $_GET ['p']. I look through the array and writes the menu html match.
If $_GET['p'] is one of the key sub-array, I display the sub-menu with a CSS class so that this menu is open.
(And the link is selected by default).

While this solution works, this system only allows me to store links like index.php?p=my_selected_page.

I wish I could put other links, like forum.php (and include menu.php in forum.php), etc..

If you have any ideas to make this possible, I would be grateful.

(I am French. Sorry for spelling mistakes.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:59:12+00:00Added an answer on May 23, 2026 at 12:59 pm

    You could use $_SERVER["SCRIPT_NAME"] to ask for the name of your script file, and then do the verification with that information, not sending a variable via GET. 🙂

    e.g.

    <?php
    
    $script_file = $_SERVER["SCRIPT_NAME"];
    $no_slashes = explode('/', $script_file);
    $script_file = $no_slashes[count($no_slashes) - 1]; 
    
    echo $script_file;
    
    ?>
    

    At this point, you will have the filename stored in $script_file, and you could match it with your array’s keys.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently designing a restaurant based menu system of iPad with the basic functionality
I am currently designing a class library that will provide data to a web
I am currently designing a Membership/Profile scheme for a new project I am working
I am currently designing a role based authentication system for resources where many users
I'm currently designing an application which I will ultimately want to move to Windows
I am currently designing a public-facing C++ API for a product which will require
I'm currently designing a smart client app (WPF) which needs to operate in an
I am currently designing a focused webcrawler. I have it tested with some websites
I am currently designing a forum as a personal project. One of the recurring
I'm currently designing a comments table for a site I'm building. Users will be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.