What I want happen is for introduction.php and mainContent.php to load link’s respective pages within them when clicked. If I was to click a link from mainMenu.php, I want to load that inside of introduction.php. When links from subMenu.php is clicked, I want to load them inside of mainContent.php. But here’s the problem!
When I click the link in mainMenu.php, the link’s page load inside of introduction.php and mainContent.php instead of being in introduction.php alone. I want one link to load in introduction.php when I click a link from mainMenu.php, and if I click a link in subMenu, I want that link to open up a page in mainContent.php.
What happens is when I click one or the other link from either mainMenu.php or subMenu.php, I reset the other link…
How can I go about this the proper way?
index.php:
<?php
include('header.php');
include('mainMenu.php');
include('introduction.php');
include('subMenu.php');
include('mainContent.php');
include('navigation.php');
include('footer.php');
?>
mainMenu.php:
<!-- mainMenu.php -->
<nav>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="index.php?page=whysave.php">Why Save</a></li>
<li><a href="index.php?page=testimonials.php">Testimonials</a></li>
<li><a href="index.php?page=contactus.php">Contact Us</a></li>
</ul>
</nav>
<!-- end of mainMenu.php -->
subMenu.php:
<!-- subMenu.php -->
<nav>
<ul>
<li><a href="index.php?page=programs.php">Programs</a></li>
<li><a href="index.php?page=savewithadp.php">Pay Less with ADP</a></li>
<li><a href="index.php?page=savingguide.php">Saving Guide</a></li>
<li><a href="index.php?page=affiliate.php">Become an Affiliate</a> <span>Call Us</span></li>
</ul>
</nav>
<!-- end of subMenu.php -->
introduction.php:
<!-- introduction.php -->
<div>
<!-- video message -->
<div>
<?php
if (isset($_GET['page'])) {
$page = $_GET['page']; /* gets the variable $page */
}
if (!empty($page)) {
include($page);
}
?>
</div>
<!-- contact form -->
<div></div>
</div>
<!-- end of introduction.php -->
mainContent.php:
<!-- mainContent.php -->
<div>
<?php
if (isset($_GET['page'])) {
$sub_page = $_GET['page']; /* gets the variable $page */
}
if (!empty($sub_page)) {
include($sub_page);
}
?>
</div>
<!-- end of mainContent.php -->