By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

$_GET['var'] works, but $var doesn't

P: n/a
Hi,
I recently installed the latest Fedora Core 2 but have some troubles of
which I'm not sure are PHP or Apache 2 related... apologies if this is the
wrong group.

"http://www.domain.ltd/index.php?var=123&"
Somehow, $var returns an empty value, while $_GET['var'] returns '123'. Need
I change a parameter in php.ini or somewhere else?

Thanks in advance for any help!
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Wed, 9 Jun 2004 10:57:18 +0200, "Sjaakie Helderhorst"
<pr**********@tell.you> wrote:
Somehow, $var returns an empty value, while $_GET['var'] returns '123'. Need


seems you should turn on your register_globals

change the line
register_globals=off

to
register_globals=on

in your php.ini file

or better yet, always user $_GET and $_POST to access your form
variables.

Regards

Marian

--
http://www.heddesheimer.de mailto:ma****@heddesheimer.de
http://www.rent-a-tutor.com Software on the Web
Jul 17 '05 #2

P: n/a
Marian Heddesheimer wrote:
or better yet, always user $_GET and $_POST to access your form
variables.


That's good advice. The good thing about using $_GET['foo'] and
$_POST['foo'] etc rather than enabling register globals and using $foo, is
that it ensures greater portability of your scripts. You may well be able
to register globals on your development box but this may not be the case
with your hosting provider.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #3

P: n/a
"Chris Hope" <ch***@electrictoolbox.com> schreef in bericht
news:10**************@news.athenanews.com...
Marian Heddesheimer wrote:
or better yet, always user $_GET and $_POST to access your form
variables.


That's good advice. The good thing about using $_GET['foo'] and
$_POST['foo'] etc rather than enabling register globals and using $foo, is
that it ensures greater portability of your scripts. You may well be able
to register globals on your development box but this may not be the case
with your hosting provider.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/


Thank you both for your help!
I usually use $_GET and $_POST, but this is a site I 'adopted', so I
encounter some difficulties.
Thanks again!
Jul 17 '05 #4

P: n/a
Regarding this well-known quote, often attributed to Sjaakie Helderhorst's
famous "Wed, 9 Jun 2004 13:35:46 +0200" speech:
"Chris Hope" <ch***@electrictoolbox.com> schreef in bericht
news:10**************@news.athenanews.com...
Marian Heddesheimer wrote:
or better yet, always user $_GET and $_POST to access your form
variables.


That's good advice. The good thing about using $_GET['foo'] and
$_POST['foo'] etc rather than enabling register globals and using $foo, is
that it ensures greater portability of your scripts. You may well be able
to register globals on your development box but this may not be the case
with your hosting provider.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/


Thank you both for your help!
I usually use $_GET and $_POST, but this is a site I 'adopted', so I
encounter some difficulties.
Thanks again!


For now, you can add code like:

<?php
$INPUTS = array_merge($_GET, $_POST, $_COOKIE);
// Eliminate any of the $_ vars you don't need.

foreach ($_INPUTS as $currentInput => $thisInput) {
${$currentInput} = $thisInput;
}
?>

(UNTESTED! TRY IT FIRST!)

It's a band-aid procedure, and a bit insecure, but it should tide you over
for now.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.