Click to See Complete Forum and Search --> : switch case


piertiong
10-31-2003, 11:21 PM
hi there, may i know what is wrong with this switch case:

<?
switch ($content)
{
case "privacy":
include("privacy.php");
break;

default:
?>
html code goes here
<?
break;
}
?>

this code is used in a .tpl file, which is called from a .php page
when i use the address example.php?content=privacy, it doesn't work.

thanks alot.

PunkSktBrdr01
10-31-2003, 11:48 PM
Try this:


<?
switch ($content) {
case 'privacy': {
include("privacy.php");
break;
}
default: {
?>
html code goes here
<?
break;
}
}
?>

piertiong
10-31-2003, 11:56 PM
still isn't working, is it because it is in a template file which is called by a php file?

PunkSktBrdr01
11-01-2003, 12:15 AM
Oh, right, forgot about that! Try putting it in a PHP file.