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! :) Quote Link to comment 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] Quote Link to comment 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. :( Quote Link to comment 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;} Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.