Jump to content

Archived

This topic is now archived and is closed to further replies.

redfire

Switch Conditionals

Recommended Posts

Okay I'm currently working on a new template, and instead of making a hole new page for every thing I'm setting it up just it just changes the one area.

[code]<?php switch($_GET['id'])
{
default:
  include('home.php');
  break; 
case 'news':
  include('news.php');
  break; 
case 'forums':
  include('forums.php');
  break; 
}
?>[/code]

and I have the links set-up like

[code]<a href="index.php?id=news">News</a>[quote][/quote][/code]

I have it set-up like that but it doesn't want to work :(

Share this post


Link to post
Share on other sites
It looks ok except put the "default" case as the last one.

See:

http://us2.php.net/manual/en/control-structures.switch.php#AEN5024

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.