Jump to content

Archived

This topic is now archived and is closed to further replies.

hostfreak

$_GET question

Recommended Posts

I was wondering, on one of the hosting accounts I have, I have to use
[code]
$_GET['variable'];
[/code]

To retrieve something from the url parameters. Whilst on another hosting account I have, I don't have to use $_GET. Why is that?

Share this post


Link to post
Share on other sites
you always need to define if the variable is coming from post or get or a cookie or a session or whatever. If you don't, php will accept it as a new variable which will cause a problem of values.

Maybe you don't need to write $_GET but $_HTTP_GET_VARS. That is because o different versions of php

Share this post


Link to post
Share on other sites
The other host has a setting called register_globals enabled. You can still use $_GET['variable'] to access the variables from the URL if your other hosts is using a PHP version greater the PHP4.3.

Share this post


Link to post
Share on other sites
[quote author=wildteen88 link=topic=107631.msg432018#msg432018 date=1157976385]
The other host has a setting called register_globals enabled. You can still use $_GET['variable'] to access the variables from the URL if your other hosts is using a PHP version greater the PHP4.3.
[/quote]

indeed, but keep in mind that it is highly suggested [b]not[/b] to have register_globals enabled. you should always write your code in such a way as to work without it enabled since, as wildteen hinted at, as of PHP 4.3, it is disabled by default.

Share this post


Link to post
Share on other sites
Makes sense now guys. Thanks. One host has php version 4.2 and the other had 4.4 . As you guys know (and I do now) the one with the 4.4 dindn't work. Well, I am off to recode it now.

Share this post


Link to post
Share on other sites

×

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.