note 64285 added to control-structures.switch
| From: | speedy_022 at hotmail dot com | Date: | Tue, 11 Apr 2006 16:58:39 +0000 |
| Subject: | note 64285 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107783@lists.php.net to get a copy of this message | ||
<?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.
----
Server IP: 66.163.161.117
Probable Submitter: 65.161.78.194
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit -- http://master.php.net/note/edit/64285
Del: integrated -- http://master.php.net/note/delete/64285/integrated
Del: useless -- http://master.php.net/note/delete/64285/useless
Del: bad code -- http://master.php.net/note/delete/64285/bad+code
Del: spam -- http://master.php.net/note/delete/64285/spam
Del: non-english -- http://master.php.net/note/delete/64285/non-english
Del: in docs -- http://master.php.net/note/delete/64285/in+docs
Del: other reasons-- http://master.php.net/note/delete/64285
Reject -- http://master.php.net/note/reject/64285
Search -- http://master.php.net/manage/user-notes.php