tgs Posted March 25, 2006 Share Posted March 25, 2006 Okay, I have a switch() set up...kind of...in a table. Anyway, I can get the defualt done (not that difficult)Now...my problem. coding my links so that open the different files in the switch.Thanks, hope that explains it well enough. Quote Link to comment Share on other sites More sharing options...
Gast Posted March 25, 2006 Share Posted March 25, 2006 [!--quoteo(post=358182:date=Mar 25 2006, 10:07 AM:name=tgs)--][div class=\'quotetop\']QUOTE(tgs @ Mar 25 2006, 10:07 AM) [snapback]358182[/snapback][/div][div class=\'quotemain\'][!--quotec--]Okay, I have a switch() set up...kind of...in a table. Anyway, I can get the defualt done (not that difficult)Now...my problem. coding my links so that open the different files in the switch.Thanks, hope that explains it well enough.[/quote]Well I don't know exactly if this is exactly what you mean, but the easiest way is to use $_GET. Say if you have a page that is called "example.php" and you want to have 5 different sections to that page, you could have "example.php?id=1", "example.php?id=2", "example.php?id=3" and so on...To do this and include a relevant file have this:[code]<?phpswitch($_GET['id']) {default : include("defaultpage.php"); break;case "1" : include("page1.php"); break; case "2" : include("page2.php"); break; }?>[/code]Hope that helps. Quote Link to comment Share on other sites More sharing options...
tgs Posted March 25, 2006 Author Share Posted March 25, 2006 No that wasn't what I meant. I meant uhm...like using text links to run those. Quote Link to comment Share on other sites More sharing options...
play_ Posted March 25, 2006 Share Posted March 25, 2006 [!--quoteo(post=358327:date=Mar 25 2006, 01:40 PM:name=tgs)--][div class=\'quotetop\']QUOTE(tgs @ Mar 25 2006, 01:40 PM) [snapback]358327[/snapback][/div][div class=\'quotemain\'][!--quotec--]No that wasn't what I meant. I meant uhm...like using text links to run those.[/quote]Yes, the code the other person posted will work.[code]<?phpswitch($_GET['id']) {default : include("defaultpage.php"); break;case "1" : include("page1.php"); break; case "2" : include("page2.php"); break; }?>[/code]then on the link, you'd have[code]echo '<a href="otherpage.php?id=1">click here to go to otherpage.php and do everything under case "1"</a>';[/code] 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.