Hi! I'm new to PHP, so forgive me if I am missing an obvious answer. I can't get a small portion of my include or switch statement to work correctly.
I am trying to develop my own site using PHP instead of frames with this layout:
|_________________________|
|_______ Header __________|
|_________________________|
[__ Nav1___ Nav2 ___ Nav3 __]
|_________________________ |
|_________________________ |
|_________________________ |
|_______ Content __________|
|_________________________ |
|_________________________ |
But within the content, I am trying to make a seperate navigation list like this:
(Content)
| [subnav item1] ___ subContent _____|
| [subnav item2] ___________________|
| [subnav item3] ___________________|
where the subContent changes depending on which subnav item is clicked.
To do this, I've been using something like this:
Code:
<!-- Sample -->
<div id="header">
<?php include('header.php')?>
</div>
<a id="nav" href="index.php?page=nav1">Nav1</a>
<a id="nav" href="index.php?page=nav2">Nav2</>
//etc for nav3
<?php
$page = $_GET['page'];
switch ($page){
case "nav1":
include('Nav1.php');
break;
//etc for nav2, nav3
default:
include('home.php');
} ?>
And then within Nav1 I will have:
<div id="subnav">
<?php include('subnav.php')?>
</div>
<div id="subcontent">
<?php
$subc = $_GET['page']
switch($subc){
case "sn1":
include('subnav1.php'); break;
default: include(Nav1_home.php) }?>
etc..
So when I visit my page, everything works except the includes statement for the content. The address bar would say "http://website.com/index.php?page=subnav1" but it would show the home page instead of the content which was written in the file subnav1.php. But however, when I visit say Nav1, the default includes "Nav1_home.php" will show up in the subcontent area
Is this because I can't do multiple switch/include statements within each other? How can I work around that? If not, what am I doing wrong?
I've been trying to search multiple forums for a problem close to this but I have not been able to come across one :[