Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/183895-if-statement-stopped-working/
Share on other sites

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'];

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

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.