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.
Re: PHP Notice: Undefined Index
i think this is what you want:
Code:
if (isset($_GET["Ex"]))
{
if ($_GET["Ex"] == "false") echo "</pre>";
}
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>";}
}
Re: PHP Notice: Undefined Index
Okay, I knew it was something like isset().