|
-
October 23rd, 2008, 03:43 PM
#1
PHP Notice: Undefined Index
Okay, I keep getting this error when someone accesses the file.
Code:
PHP Notice: Undefined index: Ex in C:\\Server\\172.16.1.35\\WhosOnline.php on line (2, 3, and 33)
I noticed that in every line, there is something like this.
PHP Code:
if ($_GET["Ex"] == "false") echo "</pre>";
Now, sometimes, there will not be a ?Ex=false, so I made it to this.
PHP Code:
if ($_GET["Ex"])
{
if ($_GET["Ex"] == "false") echo "</pre>";
}
I still get the error that the index is undefined, and this snippet is not working how I thought it would, so how do I check if it is undefined, so it will stop giving me that error.
-
October 23rd, 2008, 04:20 PM
#2
Re: PHP Notice: Undefined Index
i think this is what you want:
Code:
if (isset($_GET["Ex"]))
{
if ($_GET["Ex"] == "false") echo "</pre>";
}
-
October 23rd, 2008, 05:27 PM
#3
Re: PHP Notice: Undefined Index
PHP is a loosely typed language. That means that variable types automatically adapt. You shouldn't need quotes around the false for it to act as boolean.
PHP Code:
if (isset($_GET["Ex"])) {
if (!$_GET["Ex"]) {echo "</pre>";}
}
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
October 25th, 2008, 01:44 AM
#4
Re: PHP Notice: Undefined Index
Okay, I knew it was something like isset().
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|