Page is a not externally linkable
calvinmicklefinger - 8:32 pm on Jun 6, 2010 (gmt 0)
I am building links in the form of ...
<a href="http://mysite.com/?i=1">Link Text</a>
Which works fine with this simple switch statement ...
<?php
$var = $_GET['i'];
switch ($var) {
case 1:
include '1.php';
break;
case 2:
include '2.php';
break;
case 3:
include '3.php';
break;
default:
include 'notlost.php';
}
?>
I would like to simplify this statement so that it will operate faster, and I will not have to add a new switch statement each time I add a new page. I have tried ...
<?php
$var = $_GET['i'];
if ($var =='')
include 'notlost.php';
else
include "$var.php";
?>
It doesn't seem to work. I get a blank page when I try to use the if-else staement.
What have I messed up?
Kirk