Jump to content

How To Use Multiple Switches From Url Variables?


astralkid

Recommended Posts

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...