In that case you should have it like this:
<?php
switch ($_GET['link']) {
case 'file01.php':
echo 'link=file01.php';
break;
case 'file02.php':
echo 'link=file02.php';
break;
default:
echo 'choose from left menu item';
break;
}
?>
In "case" you define what is in the switch variable. This would be like with If statement:
if ($_GET['link']=='file01.php') {
echo 'link 1';
} elseif ($_GET['link']=='file02.php') {
echo 'link 2';
} else {
echo 'choose from left menu item';
}
I prefer the switch statement. More clear and understandable.
You should use something like I suggested in link. Use number(like id-number), not filename(I think you want to include some external file at some point or fetch the contents from database). Heres an array example(for the content part):
<?php
$link='';
$pages = array (1 => 'somepage.php',
2 => 'somepage2.php',
3 => 'somepage3.php');
if (!empty($_GET['link']))
$link = $_GET['link'];
// Check if the link-number is found in the array. If not then do something else
if (array_key_exists($link, $pages)) {
include($pages[$link]);
// for testing purpose
echo 'You chose link nr.' .$link.' which would include "' . $pages[$link] . '"';
} else {
echo 'choose from left menu item';
}
?>
..hope I didnt scare you 😉