PHP not returning variables!
Hi,
I have PHP 5 and Apache 1.3 on Windows 98. Its running OK, but whenever a
global is specified in the address, it is not passed on to the script.
For example:
"Page.php?var=value" produces the same document as just "Page.php" when they
should produce different documents.
I know it is not a bug in my script as I've had the script running fine on
my other server (PHP5, Apache 2.0, Windows XP Pro)
Any suggestions?
Many thanks in advance,
Matt Firth.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: PHP not returning variables!
[snip]
For example:
"Page.php?var=value" produces the same document as just "Page.php" when they
should produce different documents.
I know it is not a bug in my script as I've had the script running fine on
my other server (PHP5, Apache 2.0, Windows XP Pro)
[/snip]
You have echo'd $_GET['var'] and was the proper value?
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP not returning variables!
Thanks for the reply :)
That works fine. But its wierd how the old code doesnt work on my new
server.
Before, the following code worked fine when requesting
"test.php?var=myvalue"
<?
global $var;
echo $var;
?>
But on the new server it doesnt, it produces a blank page. The following
however, does work.
<?
echo $_GET['var'];
?>
Any idea why there acting differently?
Matt :)
"Jay Blanchard" <jay.blanchard [at] THERMON.com> wrote in message
news:0CEC8258A6E4D611BE5400306E1CC9270915AB95 [at] smtmb.tmc.loca l...
> [snip]
> For example:
> "Page.php?var=value" produces the same document as just "Page.php" when
> they
>
> should produce different documents.
>
> I know it is not a bug in my script as I've had the script running fine on
> my other server (PHP5, Apache 2.0, Windows XP Pro)
> [/snip]
>
> You have echo'd $_GET['var'] and was the proper value?
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: PHP not returning variables!
[snip]
But on the new server it doesnt, it produces a blank page. The following
however, does work.
<?
echo $_GET['var'];
?>
Any idea why there acting differently?
[/snip]
Yep, because register_globals (in the php.ini--if you change it make sure to
restart your web server so that ther settings take effect) is 'off' in the
new server. This is the recommended practice. As I understand it there will
ot even be a register_globals setting in PHP6.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP not returning variables!
ahh! Thanks :D
Well, I may aswell edit my scripts now if they may need editing in the
future anyway for PHP6.
Many Thanks!
Matt.
"Jay Blanchard" <jay.blanchard [at] THERMON.com> wrote in message
news:0CEC8258A6E4D611BE5400306E1CC9270915AB97 [at] smtmb.tmc.loca l...
> [snip]
> But on the new server it doesnt, it produces a blank page. The following
> however, does work.
>
> <?
> echo $_GET['var'];
> ?>
>
> Any idea why there acting differently?
> [/snip]
>
> Yep, because register_globals (in the php.ini--if you change it make sure
> to
> restart your web server so that ther settings take effect) is 'off' in the
> new server. This is the recommended practice. As I understand it there
> will
> ot even be a register_globals setting in PHP6.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: PHP not returning variables!
[snip]
ahh! Thanks :D
Well, I may aswell edit my scripts now if they may need editing in the
future anyway for PHP6.
[/snip]
That is a good plan for more reasons than that! There have been many a holy
war over the register_globals issue.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP not returning variables!
I guess register_globals = off in your php.ini (as default setting in PHP 5)
you got to use $_GET["var"] instead of $var.
Matt Firth wrote:
> Hi,
> I have PHP 5 and Apache 1.3 on Windows 98. Its running OK, but whenever a
> global is specified in the address, it is not passed on to the script.
>
> For example:
> "Page.php?var=value" produces the same document as just "Page.php" when they
> should produce different documents.
>
> I know it is not a bug in my script as I've had the script running fine on
> my other server (PHP5, Apache 2.0, Windows XP Pro)
>
> Any suggestions?
>
> Many thanks in advance,
> Matt Firth.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php