page/content linking via a switch statement
Posted: Wed Jul 10, 2002 6:35 am
hello, i am relatively new to php and i am having some trouble linking to new pages/statements via a switch statement.
here's my code:
what i get when i run this as code.php is the default statement plus the 3 links, when i click on say link1 or link 2 or link3 is the page doesn't change to the new content. The address bar show code.php?theme=1 and so on, but the page contents doesn't change 
At one stage i inserted a line to print out the $theme varible just before the switch statement begins but it was always empty.
I have searched through this board for an answer and from what i have read this code looks right..?
soo... what am i missing?? any help would be much appreciated.
here's my code:
Code: Select all
<?php
$links = "<a href="code.php?theme=1">Link1</a><br><a href="code.php?theme=2">Link2</a><br><a href="code.php?theme=3">Link3</a><br>";
switch ($theme) {
case 1:
echo "You are using theme 1<br>";
echo "$links";
break;
case 2:
echo "You are using theme 2<br>";
echo "$links";
break;
case 3:
echo "You are using theme 3<br>";
echo "$links";
break;
default:
echo "You are using the default theme<br>";
echo "$links";
break;
}
?>At one stage i inserted a line to print out the $theme varible just before the switch statement begins but it was always empty.
I have searched through this board for an answer and from what i have read this code looks right..?
soo... what am i missing?? any help would be much appreciated.