Hi, I've been having a bit of a headache with a troublesome switch statement. The problem is that when I try to call one case (eg. search) the first case shows instead (eg. list). I dont see a syntax error or sematic error, maybe one of you can. Any help is appreciated.
<a href="mypage.php">Add</a> |
<a href="mypage.php?page=list">Edit/Delete</a> |
<a href="mypage.php?page=search">Search</a>
<?php
// using isset() to stop 'Undefined Index' error
$page = isset($_GET['page']);
switch ($page) {
case 'list':
?>
// prints a html table with a list of users from DB
<?php
break;
case 'search':
?>
// prints another html table with search options
<?php
break;
default:
?>
// prints another html table for adding users to the DB
<?php
} // End Switch
?>