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 8267135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:24:25+00:00 2026-06-08T05:24:25+00:00

I am attempting to make a website that will load a certain menu.xml doc,

  • 0

I am attempting to make a website that will load a certain menu.xml doc, that was sent to it using a foreach loop. The foreach loop uses glob to grab all XML docs in a directory then prints the “name” attribute into a html link.

This has worked to up until the point were I need to pass the certain XML var used to make the link to another php doc that utilizes it.

I first attempted to use the $_SESSION to but could not as the loop would overwrite $_SESSION with each iteration. I also tried $_GET and $_POST, but I ran into the same problem with forms.

Here is my code (Please ignore any sloppyness, I am new to the PHP game):

foreach(glob("../menus/*xml") as $dom) //grabs each .xml doc in menus/
{
    $menu = simplexml_load_file($dom); //loads the file into $menu
    print "<li>";
    print "<a href = menu.php>{$menu["name"]}</a>"; //links to page menu.php
    print "</li>";
}

What I need this to do now, is to pass the individually loaded XML variable when the link is clicked.

How could I go about doing this?

Edit:

menu.xml is a page that displays the contents of the menu.xml.

  • 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-06-08T05:24:26+00:00Added an answer on June 8, 2026 at 5:24 am

    Something like this?

    <?php
    foreach(glob("../menus/*xml") as $dom) //grabs each .xml doc in menus/
    {
      $menu = simplexml_load_file($dom); //loads the file into $menu
    ?>
    <li>
        <a href="menu.php?name=<?php echo $menu["name"] ?>><?php echo $menu["name"] ?></a>
    </li>
    <?php
    }
    ?>
    

    The variable will be set into $_GET['name'] when the page is loaded.

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

Sidebar

Related Questions

I am attempting to make my first mobile website by just using a different
Attempting to make a NSObject called 'Person' that will hold the login details for
I'm attempting to make a simple linear text game that will display inside a
I am attempting to make a program that will pull data such as OS,
I'm attempting to write an iPhone App that automates actions on a certain website.
I am attempting to make a HTTPS connection to a website using HttpsURLConnection ,
I am attempting to make a pie chart using a php file that gets
I'm attempting to make a generic routine within my program that will instantiate objects
I am attempting make a simulator class that will use a Queue to add
I've inherited a website developed using Struts 1.2 that I need to make some

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.