Notice Undefined Index
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index">PHP: “Notice: Undefined variable”  and “Notice: Undefined index”</a><br>
  <a href="http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php">Reference - What does this error mean in PHP?</a>  </p>
</blockquote>



<blockquote>
  <p>Notice: Undefined index: ac in C:\xampp\htdocs\CMS\includes\login.php
  on line 6</p>
  
  <p>Notice: Undefined index: logged in
  C:\xampp\htdocs\CMS\includes\login.php on line 13</p>
</blockquote>

<p>I am receiving the above Notices with the below code. How can I define my indexes? I understand there is a way to use ISSET but I am not sure how to do it with $_SESSION logged and USERS; since there are multiple values. How would I clear up the above errors in a correct manner without just suppressing notices/errors?</p>

<pre><code>&lt;?php
session_start(); // initialize session
include($_SERVER['DOCUMENT_ROOT'] . 
        '/CMS/CMSController.php');

if ($_POST["ac"]=="log") { /// do after login form is submitted  
     if ($USERS[$_POST["username"]]==$_POST["password"]) { /// check if submitted username and password exist in $USERS array 
          $_SESSION["logged"]=$_POST["username"]; 
     } else { 
          echo 'Incorrect username/password. Please, try again.'; 
     }; 
}; 
if (array_key_exists($_SESSION["logged"],$USERS)) { //// check if user is logged or not  
    echo "You are logged in.";
    header('Location: /CMS/index.php');
} else { //// if not logged show login form 
     echo '&lt;form action="login.php" method="post"&gt;&lt;input type="hidden" name="ac" value="log"&gt; '; 
     echo 'Username: &lt;input type="text" name="username" /&gt;'; 
     echo 'Password: &lt;input type="password" name="password" /&gt;'; 
     echo '&lt;input type="submit" value="Login" /&gt;'; 
     echo '&lt;/form&gt;'; 
}; 
?&gt;
</code></pre>
