Malkavbug Posted March 22, 2006 Share Posted March 22, 2006 (editing for code clean up, sorry)After the prior one that I figured out myself last minute it does, however, bring up an entirely different issue. Here is the code (clipped down) then I will explain more[code]switch (@$forum) /*Open of forum switch*/ { case "1": /*Should be ?forum=general */ { switch (@$view) /*Open of view switch*/ { case "topics":/*Should be ?forum=1&view=topics*/ { echo "viewtopics 1 "; break; /* ends ?= caseblock */ } case "posts": /*Should be ?forum=1&view=posts*/ { echo "viewposts 1 "; break; /* ends ?= caseblock */ } break; /* ends ?= caseblock */ default: echo "1 Default "; }/*End of view switch*/ } /*End of Case 1*/ case "2": /*Should be ?forum=2 */ { switch (@$view) /*Open of view switch*/ { case "topics": /*Should be ?forum=2&view=topics*/ { echo "viewtopics 2 "; break; /* ends ?= caseblock */ } case "posts":/*Should be ?forum=2&view=posts*/ { echo "viewposts 2 "; break; /* ends ?= caseblock */ } break; /* ends ?= caseblock */ default: echo "2 Default "; } /*End of view switch*/ } /*End of Case 2*/break; /* ends ?= caseblock *//*By default show the main form page*/default: include("forumbody.php"); }/*End of forum switch*/[/code]What is workingforumstest.php = forumbody.php included, nothing elseNot workingforumstest.php?forum=1 responds with "1 Default 2 Default"forumstest.php?forum=1&view=topics responds with "viewtopics 1 viewtopics 2"So initially I thought it was some "case" collision problem. However allforumstest.php?forum=2 requests do not include the forum=1 information. In other words they are working fine.So what can I look at/do to prevent the second case from throwing stuff in if the first case is met? Why is the second case even doing anything when case "2": /*Should be ?forum=2 */ is not met?Adding in a die() statement at the end of the case 1 stuff is not an option as there are things further down this script that I need to execute. I know I could call it with an include and add a die statement, but I would rather see if there is an actual way to properly do this, and figure out why it is even acting this way to begin with.Any help is greatly appreciated.I apologize for the oddly spaced code. I tried fixing it with an edit but it seems like the code box options on the message board are throwing in tabs spaces 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.