RavynX Posted November 4, 2006 Share Posted November 4, 2006 Hey all, I've been using a switch statement in my dad's webpage in order to decide what page to display or what photos to display. It's been working for some time now, but I checked his site recently and it passes all of the cases, no matter what that variable is, and goes to the default state.Example URL: /index.php?page=pricing[code]<?php switch ($page) { case "pricing": include('pricing.inc') ; break; default: include('main.inc'); break; };?>[/code]But instead of loading the pricing.inc file it will load the main.inc. If I add a case for "main" and make the default case include pricing, the page will pop up as the pricing page.Also, I work on my /localhost/ using phpTriad, and the website works perfectly. My /localhost/ uses PHP 4.1.1 while our webhost uses 4.4.1. Was variable passing affected between the two versions? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 4, 2006 Share Posted November 4, 2006 looks like register_globals....make sure that you have $page = $_GET['page'] somewhere before that switch. Quote Link to comment Share on other sites More sharing options...
RavynX Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=ToonMariner link=topic=113849.msg462958#msg462958 date=1162670258]looks like register_globals....make sure that you have $page = $_GET['page'] somewhere before that switch.[/quote]Very nice, thanks for your help. That fixed it. :) 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.