setting default value of superglobal
<p>I have been working on a Timesheet Management website. I have my home page as <code>index.php</code></p>

<pre><code>//index.php (only relevant portion shown)
&lt;?php
      session_start();

    if($_SESSION['logged']=='set')
    {

       $x=$_SESSION['username'];

              echo '&lt;div align="right"&gt;';
              echo 'Welcome ' .$x.'&lt;br/&gt;';
              echo'&lt;a href="logout.php" class="links"&gt;&amp;nbsp;&lt;b&gt;&lt;u&gt;Logout&lt;/u&gt;&lt;/b&gt;&lt;/a&gt;' ;   

    }   

    else if($_SESSION['logged']='unset')
    {
             echo'&lt;form id="searchform" method="post" action="processing.php"&gt;
                  &lt;div&gt;
                  &lt;div align="right"&gt;
                  Username&amp;nbsp;&lt;input type="text" name="username" id="s" size="15" value="" /&gt;
                  &amp;nbsp;Password&amp;nbsp;&lt;input type="password" name="pass" id="s" size="15" value="" /&gt;
                  &lt;input type="submit" name="submit" value="submit" /&gt;
                  &lt;/div&gt;
                  &lt;br /&gt;
                  &lt;/div&gt;
                  &lt;/form&gt; ';

     }
?&gt;
</code></pre>

<p>The problem I am facing is that during the first run of this script I get an error <code>Notice: Undefined index: logged in C:\wamp\www\ps\index.php</code> but after refreshing the page the error vanishes. </p>

<p>How can I correct this problem? <code>logged</code> is a variable which helps determine whether the user is logged in or not. When the user is logged in <code>$_SESSION['logged']</code> is set, otherwise unset. I want the default value of <code>$_SESSION['logged']</code> to be <code>unset</code> prior to the execution of the script. How can I solve this problem?</p>
