Craigypoos Posted December 28, 2006 Share Posted December 28, 2006 Help! I'm pretty much a noob as far as php goes and I'd like to make a website for my band. What I want to do is have a navigation panel with links (gigs, discography etc) on the index.php page that uses url variables (index.php?content=gigs for example) so that when visitors click on the link it opens up the content.The neo-php I have so far (which obviosly I can't get to work) is something like this: <div id="menu"> <a_href="http://page2.php?content=news"><img src="images/news1.gif"></_a> <a_href="http://page2.php?content=discography"><img src="images/discography2.gif"></_a> <a_href="http://page2.php?content=biography"><img src="images/biography1.gif"></_a> </div> <div id="content"> <?php include $content.inc?> </div>(Obviously I put the underscores in so that my code is displayed here!)Like I said, I'm very much a noob, and there are probably loads wrong with my code, so if anyone can give me a laymans description (like really spell it out please!) of how to use these things I would be most grateful.Cheers,Craigypoos Link to comment https://forums.phpfreaks.com/topic/32031-solved-me-being-stupid-with-url-variables-and-using-them/ Share on other sites More sharing options...
alpine Posted December 28, 2006 Share Posted December 28, 2006 One solusion:[code]<?phpif(!empty($_GET['content'])){$include_file = $_GET['content'].".inc";if(file_exists($include_file)){ include $include_file;}else{ echo "File not found";}}?>[/code]You can also look at the switch statement --> http://no2.php.net/manual/en/control-structures.switch.php Link to comment https://forums.phpfreaks.com/topic/32031-solved-me-being-stupid-with-url-variables-and-using-them/#findComment-148687 Share on other sites More sharing options...
Craigypoos Posted December 28, 2006 Author Share Posted December 28, 2006 Many thanks. Your solution works like a dream!Craigypoos Link to comment https://forums.phpfreaks.com/topic/32031-solved-me-being-stupid-with-url-variables-and-using-them/#findComment-148742 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.