Connecting Tech Pros Worldwide Forums | Help | Site Map

Undefined variable passing vars locally via URL

Bob Bruyn
Guest
 
Posts: n/a
#1: Jul 18 '07
I've recently installed Apache 2 and php 5.2 on my WIndows XP
machine. Everything is up and running.

I'm passing some vars via the URL. It works fine online:
http://www.torusdesign.nl/spry/test....childerijenNAV

This is the code:
<?php echo $folder; ?>
<?php echo $navColor; ?>

The problem is that when I test it locally I get an error that the
variable in undefined.
Notice: Undefined variable: folder in F:\WEBSERVER\Apache2\htdocs\sonja
\test.php on line 14
Notice: Undefined variable: folder in F:\WEBSERVER\Apache2\htdocs\sonja
\test.php on line 15
Notice: Undefined variable: navColor in F:\WEBSERVER\Apache2\htdocs
\sonja\test.php on line 32

Can someone please help me out. Is there something wrong with my local
php configuration?

PS. You'll notice the Hello World at the top. That does work locally.
(if that's any help)



--


*******************

Bob Bruyn
Torus Design
Argonautenweg 45
3054 RP Rotterdam
010-4184349
http://www.torusdesign.nl


Bob Bruyn
Guest
 
Posts: n/a
#2: Jul 18 '07

re: Undefined variable passing vars locally via URL


I have it already:

<?php echo $_GET['folder']; ?>

instead of

("<?php echo $folder; ?>


--


*******************

Bob Bruyn
Torus Design
Argonautenweg 45
3054 RP Rotterdam
010-4184349
http://www.torusdesign.nl
"Bob Bruyn" <bob@torusdesign.nlwrote in message
news:7ulni.996$Rv4.592@amstwist00...
Quote:
I've recently installed Apache 2 and php 5.2 on my WIndows XP
machine. Everything is up and running.
>
I'm passing some vars via the URL. It works fine online:
http://www.torusdesign.nl/spry/test....childerijenNAV
>
This is the code:
<?php echo $folder; ?>
<?php echo $navColor; ?>
>
The problem is that when I test it locally I get an error that the
variable in undefined.
Notice: Undefined variable: folder in F:\WEBSERVER\Apache2\htdocs\sonja
\test.php on line 14
Notice: Undefined variable: folder in F:\WEBSERVER\Apache2\htdocs\sonja
\test.php on line 15
Notice: Undefined variable: navColor in F:\WEBSERVER\Apache2\htdocs
\sonja\test.php on line 32
>
Can someone please help me out. Is there something wrong with my local
php configuration?
>
PS. You'll notice the Hello World at the top. That does work locally.
(if that's any help)
>
>
>
--
>
>
*******************
>
Bob Bruyn
Torus Design
Argonautenweg 45
3054 RP Rotterdam
010-4184349
http://www.torusdesign.nl
>

amygdala
Guest
 
Posts: n/a
#3: Jul 18 '07

re: Undefined variable passing vars locally via URL



"Bob Bruyn" <bob@torusdesign.nlschreef in bericht
news:7ulni.996$Rv4.592@amstwist00...
Quote:
I've recently installed Apache 2 and php 5.2 on my WIndows XP
machine. Everything is up and running.
>
I'm passing some vars via the URL. It works fine online:
http://www.torusdesign.nl/spry/test....childerijenNAV
>
This is the code:
<?php echo $folder; ?>
<?php echo $navColor; ?>
>
The problem is that when I test it locally I get an error that the
variable in undefined.
Hello Bob,

Since your example works on the live server (which is even worse than it
working on a development server), I would advise you to read up on the ini
file directive 'register_globals':

http://nl2.php.net/register_globals

If 'register_globals' is set to 'on' an end user can easily inject your
application with variables of their choice like so:

http://www.torusdesign.nl/spry/test.php?userid=1

So I strongly advise you to turn off 'register_globals' on the live server.

HTH


Closed Thread