Jump to content

Recommended Posts

Hey, for the first time im using php navigation system for my site, so I dont really know to make it work, but I got this code from a tutorial;

 

           <?Php 

    // Define our array of allowed $_GET values

        $pass = array('test','okay','please');

            

    // If the page is allowed, include it:

        if (in_array($_GET['page'], $pass)) {

            include ($_GET['page'] . '.php'); 

        } 

        

    // This will load the default page:

        elseif (!isset($_GET['page'])) {

            include ('home.php'); 

        }



    // If the page is not allowed, send them to an error page:

        else {

                // This send the 404 header

                    header("HTTP/1.0 404 Not Found");

                // This includes the error page

                    include ($_SERVER['DOCUMENT_ROOT'] . '/error.php');

        }

?>

 

First ill explain how my site is set up maybe that will help you help me, I have a page, that has a table with 3 columns, in the left I have an include statement all my left menues, the center is my main content, and right is an include statement for my right menues. So i have that code in my center box for my content. In the left page that I inlcude, i have my links;

 

<a href="index.php?id=test">test<br />
                            </a><a href="index.php?id=okay">okay</a><br />
                            <a href="index.php?id=please">please</a></td>

 

When I load my index.php it sucessfully brings me to home.php so i guess the

 

        elseif (!isset($_GET['page'])) {

            include ('home.php'); 

        }

is working.

But when I click on the links it doesnt do anything, it like loads home.php again.

 

Please help me, thanks a lot!

Link to comment
https://forums.phpfreaks.com/topic/90613-navigation-system-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.