Hi,

So, I'm working on some PHP scripts, and I never noticed this happening before, but on all of my PHP scripts, any POST variables automatically become regular variables.

For example:

If I have a post variable $_POST

passed through a web form, and then I look at the variable

$firstName

for some reason it has the post variable, which is messing up variables, where $firstName has a value and I'm trying to give it some other value. Is there a setting that makes that happen, and is there a way to turn it off? I've been programming PHP for a good 4 years now, and have never really run into this problem, so I'm not sure what's going on.

turn register_globals off. its a php setting.

AH, awesome, thank you very much.

I couldn't remember the setting name but I remembered something concerning that. After you mentioned that I checked my phpinfo() and sure enough, Register Globals was on. So I checked with my web host provider and guess what? Why, I have no idea. But they used to have Register Globals turned off and just randomly decided, hey, let's turn it on by default.

Although I think they completely redid their PHP configuration, because I think it used to be apache module, but now its a CGI, but anyway, I was able to use the php.ini file to turn off the registered globals, so thanks for the direction!

I can now continue developing my script without wondering what the heck happened to it. lol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.