How would I use multiple switches in a page that would get its cases from url variables?
ie: [/i]www.site.com/index.php?page=x&sub=y&act=z[/i]
<?php
switch ($page) {
case 'x': include('page.php'); break;
case 'x2': include('page2.php'); break;
default: code; break;
}
switch ($sub) {
case 'x': include('sub.php'); break;
case 'x2': include('sub2.php'); break;
default: code; break;
}
switch ($act) {
case 'x': include('act.php'); break;
case 'x2': include('act2.php'); break;
default: code; break;
}
?>
I'm curious as to how if i was to use:
index.php?page=admin&sub=blog&act=edit_post
...as to how I would be able to use switches via the admin.php/blog.php pages. From admin.php, I have the following in a switch:
-blog manager
-files manager
-photo gallery
-quotes manager
and inside these pages I have "add/edit/delete/view" functions also in a switch. When I try a $sub = $_GET['sub']; or $act = $_GET['act']; and use the 'sub/act' switch, it doesn't switch according to which 'sub/act' variable I call through the URL.
Is there another way to do this or am I going about this wrong via the switches? Hopefully my meaning is clear on this.
Thanks for any help.