title: PHP - Notice: Undefined index: $_SESSION['login'] on header.php
body: <p>I'm having this error on my header.php which has all the html/bootstrap for my navigation bar.</p>
  
  <pre><code>&lt;?php
          if($_SESSION['login']) {
          ?&gt;
              &lt;ul class="nav navbar-nav"&gt;
                  &lt;li&gt;&lt;a href="dashboard.php"&gt;Dashboard&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="settings.php"&gt;Settings&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
              &lt;ul class="nav navbar-nav navbar-right"&gt;
                  &lt;p class="navbar-text"&gt;Hello, &lt;?php $name; ?&gt;&lt;/p&gt;
                  &lt;li&gt;&lt;a href="logout.php"&gt;Log Out&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;?php
          } else {
          ?&gt;
              &lt;ul class="nav navbar-nav navbar-right"&gt;
                  &lt;li&gt;&lt;a href="login.php"&gt;Log In&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;?php
          }
          ?&gt;
  </code></pre>
  
  <p>It keeps showing on my navigation bar but it works fine:</p>
  
  <blockquote>
    <p>"Notice: Undefined index: login in C:\xampp\htdocs\hotel-sys\includes\header.php on line 36" </p>
  </blockquote>
  
  <p>It just keeps showing that notice. How can I solve it?</p>