Jump to content


Photo

$_GET question


  • Please log in to reply
4 replies to this topic

#1 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 11 September 2006 - 11:58 AM

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

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

#2 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 11 September 2006 - 12:04 PM

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
Roy Simkes
Yet Another Parkyeri Developer

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 11 September 2006 - 12:06 PM

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.

#4 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 11 September 2006 - 12:46 PM

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.


indeed, but keep in mind that it is highly suggested not 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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#5 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 11 September 2006 - 12:49 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users