freelancer Posted January 27, 2007 Share Posted January 27, 2007 Hello, I'm not very good at PHP so I think you may help me in this case. I'm using this for including pages and URL comes like index.php?k=[b]whatever[/b] and all works. But now I want to add new 'if' under my TEAM page. There will be members and if you click on someones name then address comes like index.php?k=team&id=[b]playername[/b]. There is code I made. This works fine and includes certain page to place where I put this script. What should I add or do?[code]<?phpif (($k == 'news') or ($k =='')) { include("news/news.php"); } else if ($k == 'articles') { include('articles.php'); } else if($k == 'team') { include('team.php'); } else if($k == 'results') { include('results.html'); } else if($k == 'about') { include('about.html'); } else if($k == 'servers') { include('servers.html'); } else if($k == 'sponsors') { include('sponsors.html'); } else if($k == 'contact') { include('contact.html'); } ?>[/code]Thank you! :) Link to comment https://forums.phpfreaks.com/topic/35975-including-pages/ Share on other sites More sharing options...
HoTDaWg Posted January 27, 2007 Share Posted January 27, 2007 well there is a much more easier way to do your task. it is called cases.[url=http://ca3.php.net/switch]http://ca3.php.net/switch[/url] Link to comment https://forums.phpfreaks.com/topic/35975-including-pages/#findComment-170630 Share on other sites More sharing options...
freelancer Posted January 27, 2007 Author Share Posted January 27, 2007 [quote author=HoTDaWg link=topic=124321.msg514881#msg514881 date=1169927243]well there is a much more easier way to do your task. it is called cases.[url=http://ca3.php.net/switch]http://ca3.php.net/switch[/url][/quote] I took look over it, but I didn't get how does this work. :( Link to comment https://forums.phpfreaks.com/topic/35975-including-pages/#findComment-170641 Share on other sites More sharing options...
Jessica Posted January 27, 2007 Share Posted January 27, 2007 switch($k){ case 'news': include ('news.php'); break; case 'bob': include ('bob.php'); break;} Link to comment https://forums.phpfreaks.com/topic/35975-including-pages/#findComment-170644 Share on other sites More sharing options...
freelancer Posted January 27, 2007 Author Share Posted January 27, 2007 Got this working now, but how I make now other links that becomes like: index.php?k=team&id='playername' for example? Link to comment https://forums.phpfreaks.com/topic/35975-including-pages/#findComment-170664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.