astralkid Posted December 2, 2012 Report Share Posted December 2, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.