hi im using a script to include scripts based in $_GET but im getting a erorr
<?php
$config = array(
'videos' => 'dynapage/scripts/videos.php',
'testbed' => 'dynapage/scripts/testbed.php'
);
if(isset($config[$_GET['page']])) {
include($config[$_GET['page']]);
}
else {
include("home.php");
}
?>
im getting the following error
Notice: Undefined index: page in D:\webdesign\webserver\root\dynapage\scripts\pagecheck.php on line 7
any help much apreciated
Try this :
In
ifcondition, conditions are checked from first to last, in sequence, in the above case, earlier you were requesting$_GET['page']]which checking is that is Available or not, Putting theisset($_GET['page']])does this job, if not set, further conditions will not be checked.