title: isset() didn't work after login with $_SESSION set to valid
body: <p>I have this loginform.php with this part of code (this was called from index.php with a login form):</p>
  
  <pre><code>include("config.php");
  if(isset($_POST['submit']))
  {
      $username = $_POST['username'];
      $password = $_POST['password'];
  
      if($username == "" || $password == "")
      {
          echo "Either username or password field is empty.";
          echo "&lt;br/&gt;";
          echo "&lt;a href='index.php'&gt;Go back&lt;/a&gt;";
      }
      else
      {
          $result = mysql_query("select * from users where user_username='$username' and user_password='$password'",$conn)
          or die("Could not execute the select query.");
  
          $row = mysql_fetch_assoc($result);
  
          if(is_array($row) &amp;&amp; !empty($row))
          {
              $validuser = $row['username'];
              $_SESSION['valid'] = $validuser;
          }
          else
          {
              echo "Username and password do not match.";
              echo "&lt;br/&gt;";
              echo "&lt;a href='index.php'&gt;Go back&lt;/a&gt;";
          }
  
          if(isset($_SESSION['valid']))
          {
              header("Location:index.php?");
          }
      }
  }
  </code></pre>
  
  <p>but after that it should've shown again the index.php without the login form</p>
  
  <p>index.php had this code to display the user after successful login:</p>
  
  <pre><code>    &lt;?php
  if(isset($_SESSION['valid']))
  {   
      include("config.php");
      $result = mysql_query("select * from users",$conn);
      echo "Welcome ".$_SESSION['valid']. "! &lt;a href='logout.php'&gt;Logout&lt;/a&gt;&lt;br/&gt;";
  }
  else
  {
      require('./loginform.php');
  }
  ?&gt;
  </code></pre>
  
  <p>with this code the login form do not showed up but instead not showing anything. It should display the user that had logged in. I dont know what I missed. Im a newbie at php. Please help. sorry, please assumed that there is a session start at all file.</p>