Undefined Index? PHP error.
I have the following on a PHP page:
<?php if ($_GET["auth"] == 1) { ?>
<span class="smallred">You have entered incorrect login credentials, don't have authorisation to view the page you've requested or you have been signed out due to a period of inactivity.</span>
<?php } ?>
If, upon arriving on our index.php page, the querystring "auth" has a value of 1 then this error message is to be displayed. However, if a user simply arrives at this page and no querystring is set we get the following error:
Notice: Undefined index: auth in C:\inetpub\wwwroot\website\admin\index.php on line 45
I only noticed this because I have this at the top of the page:
<?php error_reporting(E_ALL); ini_set('display_errors','on'); ?>
...but I have wee sections of code like this all over the place, on lots of sites. Is my approach wrong?
Thanks for any advice offered.
NJ