Re: Undefined index, Undefined variable, Undefined constant....
| From: | Erwin | Date: | Fri, 06 Sep 2002 07:57:10 +0000 |
| Subject: | Re: Undefined index, Undefined variable, Undefined constant.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115406@lists.php.net to get a copy of this message | ||
Jens Winberg wrote:
> I'm having trouble with the newest version of PHP (4.2.2).
> For example in a page I'm using the following code:
> if ($_GET['action'] == "logout") {
> //do something
> }
>
> But I'm getting an error message that says:
> ...log_message reports: PHP Notice: Undefined index: action in....
>
> Ealier (other versions of PHP) I have succesfully used the above
> code, but do I now have to rewrite the code like this:
> if (isset($_GET['action']) AND $_GET['action'] == "logout") {
> //do something
> }
>
> Or am I totally wrong?
> This was just one example when I'm getting the message "Undefined
> index" or " Undefined variable" etc. A lot of code which has
> previously worked is now giving me loads of headache since I have to
> rewrite everything.
Heh, that can be solved by setting the error_reporting in the php.ini to
"E_ALL & ~E_NOTICE"
They can also be disabled by putting the line error_reporting( E_ALL &
~E_NOTICE ) at the first (second, after the <?php) line in your code.
HTH Erwin