undefined index

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jagsdj
Forum Newbie
Posts: 3
Joined: Thu May 01, 2003 7:47 am

undefined index

Post by jagsdj »

Cannot seem to figure out this error...
could somebody please explain it...

<Notice:undefined index: Color in g:\\path\fulename.php on line 3>

all help is greatly appreciated!

jag
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

Can you post your script?

The error has something to do with array's.

But it's a Notice, if you set your error_reports to:
error_reporting (E_ERROR | E_WARNING | E_PARSE);

You won't have any trouble again.
jagsdj
Forum Newbie
Posts: 3
Joined: Thu May 01, 2003 7:47 am

undefined index

Post by jagsdj »

here's the line where the error is occuring:

if($HTTP_COOKIE_VARS["Color"]=="be1f13"){$admin=true;} // Logged in as Admin.


thanks again
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

Do you check if even the cookie is set?

Code: Select all

if(isset($HTTP_COOKIE_VARS&#1111;"Color"]))&#123;
  if($HTTP_COOKIE_VARS&#1111;"Color"]=="be1f13")&#123;$admin=true;&#125; // Logged in as Admin.
&#125;
jagsdj
Forum Newbie
Posts: 3
Joined: Thu May 01, 2003 7:47 am

undefined index

Post by jagsdj »

Jason

I inherited this proj from another consultant, so please forgive me if my questions are responses are kinda slow...

okay, i thin the cookie is set by the following code:

if(@file_exists($level2)){
setcookie ("Color", "be1f13");
}elseif(@file_exists($level1)){
setcookie ("Color", "f1f2f2");
}else{
setcookie ("Color", "ffffff");
}

$level1 and $level2 are different paths to different filnames.
Post Reply