Jump to content

How do I clear the existing page?


crmamx

Recommended Posts

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-language" content="en" />
<link type="text/css" rel="stylesheet" href="css/reset.css"  />
<link type="text/css" rel="stylesheet" href="css/960.css"  />
<link type="text/css" rel="stylesheet" href="css/custom.css"  />
        <title>BAY AREA REMOTE CONTROL SOCIETY</title>
</head>
    <body>
        <div id="wrapper" class="container_12">
            <div id="header" class="grid_12">
                <div id="left-header" class="grid_5 alpha"></div>
                <div id="newsflash" class="grid_7 omega"><?php include('content/newsflash.php'); ?></div>
            </div>
            <div id="leftmenu" class="grid_3"><?php include('content/menu.php'); ?></div>
            <div id="maincontent" class="grid_9"><?php include('content/maincontent.php'); ?></div>
            <div id ="footer" class="grid_12"><?php include('content/footer.php'); ?></div>
        </div><!-- end wrapper -->
    </body>
</html>

 

menu.php

<?php

?>
<div class="content">
<ul id="menu">
    <li><a href="index.php?page=testpage"><span>Home</span></a></li> 
    <li><a href="index.php?page=about"><span>About us</span></a></li>
    <li><a href="index.php?page=schedule"><span>Schedule</span></a></li>
    <li><a href="index.php?page=media"><span>Media</span></a></li>
    <li><a href="index.php?page=products"><span>Products</span></a></li>
    <li><a href="index.php?page=misc"><span>Miscellaneous</span></a></li>
</ul>
</div>

 

When I click HOME on the Menu program it works fine but it does not clear the content of maincontent.php. How do I do that?

Link to comment
https://forums.phpfreaks.com/topic/229258-how-do-i-clear-the-existing-page/
Share on other sites

try this code

<div id="maincontent" class="grid_9">
<?php

if(isset($_GET['page']) and !empty(($_GET['page'])){
$page="content/".$_GET['page'].'.php';
if(file_exists($page)){
include($page);
}
else{
echo 'error';
}

}
else{
include('content/maincontent.php'); ?></div>
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.