|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP navigation
Hey guys, just a quick question.
On sites with URLs such as: core.php?s=profile&user=him how do I get the second part user=him ? I use this code to get the first bit. Code:
<?php
switch($s) {
case "home":
include("blog.php");
break;
case "port":
include("port.php");
break;
case "link":
include("link.php");
break;
default:
include("blog.php");
break;
}
?>
Thanks for any help. I figure I need to add another switch, but not sure where. Would you like my main page code?
__________________
My Site in the works Last edited by wastedbreath : August 31st, 2003 at 10:07 PM. |
|
#2
|
|||
|
|||
|
Ok, here it is better explained, or so the other forum I postted at thought
![]() On my main page I have these links: -home -portfolio -links When I click Portfolio, the URL in the address bar will become: main.php?s=port And on the Portfolio page the secondary menu will load: -photo manip -photography -experimental -traditional -php -c++ And I want the URL to be: main.php?s=port&ss=mainp How do I get the &ss=manip? |
|
#3
|
|||
|
|||
|
Let us first resolve your first issue.
I notice you have your default case first in your switch statement. Your default case should be the last case statement.
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#4
|
|||
|
|||
|
Ok. Fixed.
|
|
#5
|
|||
|
|||
|
Next think to do is go ahead and nest another switch statement in there.
It is ok to nest a switch statement. Optionally, you can go another route. PHP Code:
This code is not tested but you should be able to work out any minor syntax / logic errors. |
|
#6
|
|||
|
|||
|
Excellent. Thanks man! I think I'll try nesting a switch statement, if that doesn't work, I'll try your code, and if *that* doesn't work, all hell will break lose on my monitor
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP navigation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|