Malkavbug Posted March 22, 2006 Share Posted March 22, 2006 You know I am probably taking the wrong approach to this to begin with but here we goYou can see what I am trying to do in the code (stripped down with comments)[code] switch (@$forum) /*Open of forum switch*/ { case "general": /*Should be ?forum=general */ switch (@$view) /*Open of view switch*/ { case "topics": /*Should be ?forum=general&view=topics*/ { echo "viewtopics General wheeee "; /*Temp to see if it is working*/ break; /* ends ?= caseblock */ } case "posts": /*Should be ?forum=general&view=posts*/ { echo "viewposts General wheeee yippie!! "; /*Temp to see if it is working*/ break; /* ends ?= caseblock */ } } /*End of view switch*/ default: echo "Gen Default "; break; /* ends ?= caseblock */ }[/code]The problem is.....Actually, now that I look at it the problem is that I am an idiot.Default is executing because I never broke the switch prior to it hitting that line default: echo "Gen Default "; break; /* ends ?= caseblock */changed to break; /* ends ?= caseblock */ default: echo "Gen Default ";Works just fine.So I will just post this for other newbies like myself to reference and learn from my initial mistake.Love you guys here :P Quote Link to comment https://forums.phpfreaks.com/topic/5467-update-no-reply-needed-default-executing-even-when-switch-case-value-is-met/ 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.