Good Morning:
I'm working on a few switch statements, and can't find any examples or assistance for what I am doing. I am using switch statements to specify URL variables (e.g. a switch to show case calendar for the URL index.php?page=calendar).
This is working fine, but where I come into my problem, is when I need to specify 2 variables (e.g. to specify page=calendar, but id=# also). Below is the current code I have.
<?php
switch ($_GET['page']) {
case about:
echo ("Display coding for about page");
break;
case roster:
echo ("Display coding for team roster");
break;
case games:
echo ("Display coding for games");
break;
default:
echo ("Display coding for main page");
} ?>
What I need to do, is for roster and games, I need to have an additional variable specified which is $_GET['id']...I tried this:
<?php
switch ($_GET['page']) {
case about:
echo ("Display coding for about page");
break;
case roster:
$id = $_GET['id'];
switch ($_GET['page'] = 'roster' && $_GET['id']) {
case $id:
echo ("Display info specific to ID");
break;
default;
echo ("Display main team page"); }
case games:
echo ("Display coding for games");
break;
default:
echo ("Display coding for main page");
} ?>
When I do this and go to index.php?page=roster, it says "Display info specific to ID", instead of the main team page. Can someone help me get this fixed?