note 64285 rejected from control-structures.switch by bjori
| From: | bjori@php.net | Date: | Tue, 11 Apr 2006 17:12:05 +0000 |
| Subject: | note 64285 rejected from control-structures.switch by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107785@lists.php.net to get a copy of this message | ||
Note Submitter: speedy_022 at hotmail dot com
----
<?php
switch ($_GET['go']) {
case "1": $inc = 'Page01.php';
break;
case "2": $inc = 'Page02.php';
break;
case "3": $inc = 'Page03.php';
break;
case "4": $inc = 'Page04.php';
break;
default: $inc = 'Page01.php';
break;
}
include ($inc);
?>
On the above code what if the go doesn't exist, what coding do you put to keep from getting an
error saying it's an undefined index.