Click to See Complete Forum and Search --> : [RESOLVED] Whats up with the notices?


Kyleva2204
03-26-2006, 06:01 PM
Hey- I just have a question.. Whats up with the error notices? How do you prevent them? I don't understand what the errors mean really.. anyone wanna help and explain please? :D

thanksss

Sheldon
03-26-2006, 06:09 PM
an error notice means your code is not working, You want that to show so you can fix them.

Most errors are pretty self explainatory!

post a error notice your gettign and illl explain it to you

Kyleva2204
03-26-2006, 06:44 PM
Notice: Undefined index: del_lang_cookie in C:\Program Files\Abyss Web Server\htdocs\community\modules\cookie.php on line 11

Notice: Undefined variable: text in C:\Program Files\Abyss Web Server\htdocs\community\modules\page_load.php on line 11

Notice: Use of undefined constant lang - assumed 'lang' in C:\Program Files\Abyss Web Server\htdocs\community\resources\language.php on line 8

Notice: Undefined index: lang in C:\Program Files\Abyss Web Server\htdocs\community\resources\language.php on line 8

Notice: Use of undefined constant lang - assumed 'lang' in C:\Program Files\Abyss Web Server\htdocs\community\resources\language.php on line 11

Notice: Use of undefined constant lang - assumed 'lang' in C:\Program Files\Abyss Web Server\htdocs\community\resources\language.php on line 12

NogDog
03-26-2006, 07:52 PM
The undefined constants are probably unquoted array indices. You should use $_POST['lang'], not $_POST[lang]. You can get away with it most of the time, as PHP will assume that an undefined constant has a value of a string the same as its name. But for proper code that will not throw warnings, quote your array indices (unless they're variables or previously defined constants).

The undefined index warning is due to referencing an array element which has not been set (such as a $_POST element on a page that wasn't called by a form). If your page can possibly be called in such a way, then you should check to see if such a value isset() before referencing it:

if(isset($_POST['lang']))
{
$lang = $_POST['lang'];
}
else
{
$lang = "";
}

NogDog
03-26-2006, 07:55 PM
PS: See error_reporting() (http://www.php.net/error_reporting) should you really want to change the reporting level.

Kyleva2204
03-26-2006, 09:27 PM
Thankss that really helped- heh no more notices! w00t!