TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Some functions NOT DEFIND! (http://www.talkphp.com/absolute-beginners/2853-some-functions-not-defind.html)

Yoosha 05-27-2008 05:17 PM

Some functions NOT DEFIND!
 
Hi,
Some functions not defined! Why?

Notice: Undefined variable: HTTP_GET_VARS
Notice: Undefined variable: dir_files
Notice: Undefined variable: PHP_SELF
...
:-/

Alex 05-27-2008 06:22 PM

Quote:

Originally Posted by Yoosha (Post 14913)
Notice: Undefined variable: HTTP_GET_VARS
Notice: Undefined variable: dir_files
Notice: Undefined variable: PHP_SELF
...
:-/

1. Try $_GET instead
2. Not sure about this
3. Shouldn't you be using $_SERVER['PHP_SELF'] ?

Wildhoney 05-27-2008 07:03 PM

2. I'm guessing that's supposed to be an array key? After all, who puts underscores in their variable names, excluding PHP with their $_POST and $_GET, et cetera. (Hands up those who do!). Nonetheless, I assume it would be $data['dir_files'].

sketchMedia 05-27-2008 07:14 PM

i think that its because you have 'register_globals' off, you can only access $PHP_SELF with register globals on i think.

use $_SERVER and other superglobals instead.

Kalle 05-27-2008 10:01 PM

First off, its not functions its magic variables/arrays! =)

Notice: Undefined variable: HTTP_GET_VARS
This is due to register_long_arrays being off, use $_GET insted of $HTTP_GET_VARS or activate register_long_arrays (deprecated not recommeded!)

Notice: Undefined variable: PHP_SELF
This is due to register_globals, use $_SERVER['PHP_SELF'] insted or activate register_globals (deprecated and not recommeded!)

Notice: Undefined variable: dir_files
That not a PHP variable, its a custom variable in the script, the notice is generated in examples like the one below:

PHP Code:

foreach(php_uname() as $key => $value)
{
    
/** Notice: Undefined variable: uname */
    
$uname .= $key ': ' $value PHP_EOL;


To fix such notices you need to define the variable before usage, in the example above we would have to put this in before we run the foreach loop:

PHP Code:

$uname ''



All times are GMT. The time now is 10:48 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0