gple Posted December 3, 2009 Share Posted December 3, 2009 All of a sudden, my If else statement still goes into the wrong the nest. for istance if ($enter==0) {echo "hello";} else if ($enter==1) {echo "Goodbye";} else{} even when i go to the link index.php?enter=1, it still outputs HELLO. this just started to happen after a year of working without a problem. Any ideas or is anyone else experiencing this. Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/ Share on other sites More sharing options...
slyte33 Posted December 3, 2009 Share Posted December 3, 2009 All of a sudden, my If else statement still goes into the wrong the nest. for istance if ($enter==0) {echo "hello";} else if ($enter==1) {echo "Goodbye";} else{} even when i go to the link index.php?enter=1, it still outputs HELLO. this just started to happen after a year of working without a problem. Any ideas or is anyone else experiencing this. If you don't already have this, add it: $enter = $_GET['enter']; Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970772 Share on other sites More sharing options...
mikesta707 Posted December 3, 2009 Share Posted December 3, 2009 You probably had register globals set to ON in your php.ini, and with some update to your server it was set off, slyte's suggestion should probably work Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970777 Share on other sites More sharing options...
gple Posted December 3, 2009 Author Share Posted December 3, 2009 is there anyway to put this back the other way. There are too many pages with too many variables to go in and change them. Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970805 Share on other sites More sharing options...
mikesta707 Posted December 3, 2009 Share Posted December 3, 2009 go into your PHP.ini and set register_globals to on Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970808 Share on other sites More sharing options...
mrMarcus Posted December 3, 2009 Share Posted December 3, 2009 keep in mind though that register_globals has one foot out the door already. it is being removed from PHP v6 and is already deprecated as of v5.3.0 if you do not alter your code, you could get burned in the not-so-distant future. Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970819 Share on other sites More sharing options...
mikesta707 Posted December 3, 2009 Share Posted December 3, 2009 keep in mind though that register_globals has one foot out the door already. it is being removed from PHP v6 and is already deprecated as of v5.3.0 if you do not alter your code, you could get burned in the not-so-distant future. Very true, and I should have expanded on my answer. I suggest fixing it now so you don't have to worry about it later, unless you plan on getting out of the web design any time soon Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970821 Share on other sites More sharing options...
premiso Posted December 3, 2009 Share Posted December 3, 2009 Note that turning on Register_globals is not recommended due to the security hole that can be created. That is why it is now defaulted to off and is preferred to be off. If you do have it on, make sure you define all your variables anyways before using, as not doing so is where the issue can come into play (at least the major variables). And as Marcus pointed out, it is being completely removed soon, so yea. Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970824 Share on other sites More sharing options...
PFMaBiSmAd Posted December 4, 2009 Share Posted December 4, 2009 At the risk of causing a huge discussion about what depreciated means and when something actually becomes depreciated (regardless of what the documentation states), register_globals were actually depreciate in php4.2 when they were turned off by default and they were superseded by the use of the correct super global arrays (which is the definition of depreciated - http://en.wikipedia.org/wiki/Deprecated ) The only change in php5.3 is that the register_globals setting being on will now cause an E_DEPRECATED error to be thrown at startup. Quote Link to comment https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/#findComment-970904 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.