problem with predefined variables

Поиск
Список
Период
Сортировка
Искать

problem with predefined variables

От:
SG Edwards <s0460205@sms.ed.ac.uk>
Дата:


Hi,

I am just learning PHP and have a very simple script to access data in a
predefined variable as follows:


$PHP_SELF.

\n"; echo 'you are viewing this page usinig:
', $HTTP_USER_AGENT, '
from the IP address ', $REMOTE_ADDR; ?> 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 .

you are viewing this page usinig:
PHP Notice: Undefined variable: HTTP_USER_AGENT in /home/s0460205/public_html/test.php on line 11
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)

Re: problem with predefined variables

От:
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Дата:
> 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 .

> you are viewing this page usinig:
PHP Notice: Undefined variable: > HTTP_USER_AGENT in /home/s0460205/public_html/test.php on line 11 >
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
FAQ