pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem with predefined variables
2+ messages / 2 participants
[nested] [flat]
* problem with predefined variables
@ 2005-04-05 15:09 SG Edwards <s0460205@sms.ed.ac.uk>
2005-04-05 15:25 ` Re: problem with predefined variables Christopher Kings-Lynne <chriskl@familyhealth.com.au>
0 siblings, 1 reply; 2+ messages in thread
From: SG Edwards @ 2005-04-05 15:09 UTC (permalink / raw)
To: pgsql-php
Hi,
I am just learning PHP and have a very simple script to access data in a
predefined variable as follows:
<body>
<?php
echo "you are running the file <b>$PHP_SELF</b>.<br /><br />\n";
echo 'you are viewing this page usinig: <br /><b>', $HTTP_USER_AGENT, '</b><br
/>from the IP address ', $REMOTE_ADDR;
?>
</body>
However, the assignment does not happen, giving the command line error (PHP
Notice: Undefined variable: PHP_SELF in /home/s0460205/public_html/test.php
on line 10
you are running the file <b></b>.<br /><br />
you are viewing this page usinig: <br /><b>PHP Notice: Undefined variable:
HTTP_USER_AGENT in /home/s0460205/public_html/test.php on line 11
</b><br />from the IP address PHP Notice: Undefined variable: REMOTE_ADDR in
/home/s0460205/public_html/test.php on line 11)
- why would this occur?
Many thanks
(I am running PHP/4.3.10)
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: problem with predefined variables
2005-04-05 15:09 problem with predefined variables SG Edwards <s0460205@sms.ed.ac.uk>
@ 2005-04-05 15:25 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Kings-Lynne @ 2005-04-05 15:25 UTC (permalink / raw)
To: SG Edwards <s0460205@sms.ed.ac.uk>; +Cc: pgsql-php
> However, the assignment does not happen, giving the command line error (PHP
> Notice: Undefined variable: PHP_SELF in /home/s0460205/public_html/test.php
> on line 10
> you are running the file <b></b>.<br /><br />
> you are viewing this page usinig: <br /><b>PHP Notice: Undefined variable:
> HTTP_USER_AGENT in /home/s0460205/public_html/test.php on line 11
> </b><br />from the IP address PHP Notice: Undefined variable: REMOTE_ADDR in
> /home/s0460205/public_html/test.php on line 11)
>
> - why would this occur?
You have register_globals = off in your php.ini.
Try $_SERVER['PHP_SELF'] and $_SERVER['HTTP_USER_AGENT'] and
$_SERVER['REMOTE_ADDR']
And read about superglobals and register_globals in the PHP docs.
Chris
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-04-05 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-05 15:09 problem with predefined variables SG Edwards <s0460205@sms.ed.ac.uk>
2005-04-05 15:25 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox