hey well i'm not very good at PHP but I've decided to create a PHP navigation and i'm basically echoing the page data onto the page is there anyway i could like echo an whole page content on there with like a include or something, here is my code if anyone else knows any other ways to do a navigation like this please let me know. <BODY><div id="container"> <div id="navigation"> <ul> <li><a href="?">Home</a></li> <li><a href="?page=about">About</a></li> <li><a href="?page=products">Products</a></li> <li><a href="?page=contact">Contact</a></li></ul> </div> <?php switch($_GET['page']) { case "about": echo "<div id=\"content\">about page content goes here</div>"; break; case "products": echo "<div id=\"content\">products page goes here</div>"; break; case "contact": echo "<div id=\"content\">contact page goes here</div>"; break; default: echo "<div id=\"content\">Home page goes here </div>"; break; }?> </div> Code (markup): ]
A better way to do what you want is : $aPages = array("about"=>true,"products"=>true,"contact"=>true); if (isset($_GET['page'])) if ($aPages[$_GET['page']]) include($_GET['page']."php"); else include("default.php"); else include("default.php"); PHP: Good luck
hey ive had a lil play around with the code you gave me keep getting errors with the include, i was wondering if you could tell me which lines on there i should change to link to contact.php and stuff thanks.
ok ive got the code working its just now when i change one the links to about.php it changes 3 of my navigation links to direct to that page when i only wont one of the links to direct to that oage, could u tell me which link parts i change in your code thanks.