lennon123 Posted April 16, 2008 Share Posted April 16, 2008 hi guys, this is probably a very basic question, hopefully this will be a doddle to answer. Im fairly new to php, I have a menu set up and when the user clicks on one of the links it parses a value to the variable $page. What I want php to do is display a text file, dynamically, based on the value of $page. i.e if $=home then dynamically load in home.txt into a div tag and so on. Any one help? cheers Link to comment https://forums.phpfreaks.com/topic/101360-solved-php-navagation/ Share on other sites More sharing options...
soycharliente Posted April 16, 2008 Share Posted April 16, 2008 I would use a $_GET and a switch. <html> <body> <a href="index.php?page=home">Home</a> <a href="index.php?page=about">About</a> <a href="index.php?page=contact">Contact</a> <?php $p = $_GET['page']; switch ($p) { case "home": include "home.txt"; break; case "about": include "about.txt"; break; case "contact": include "contact.txt"; break; default: include "error.txt"; break; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/101360-solved-php-navagation/#findComment-518430 Share on other sites More sharing options...
lennon123 Posted April 16, 2008 Author Share Posted April 16, 2008 thnkas a lot! Link to comment https://forums.phpfreaks.com/topic/101360-solved-php-navagation/#findComment-518482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.