title: undefined index error using session on php
body: <p>I have a login.php file with a form to login.
  I have a validation.php file to validate login, with this code:</p>
  
  <pre><code>&lt;?php
  
  session_start();
  
  if(($_SESSION['user'] == "user123") &amp;&amp; ($_SESSION['pass'] = "123"))
  {
  
   header("Location: index.php");
  
  }
  
  else
  {
   header("Location: login.php");
  }
  
  ?&gt;
  </code></pre>
  
  <p>And i have a index.php file, when i do the login i want go to index.php page, with this code:</p>
  
  <pre><code>&lt;?php
  
  session_start();
  if(($_SESSION["user"]) and ($_SESSION["pass"]))
  {
      ?&gt;
  
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml2-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1993/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=u2f-5" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;p&gt;geageagge&lt;/p&gt;
  &lt;p&gt;egeageage&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;p&gt;geagaegea&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  }
  else
   echo "You didnt do login";
  </code></pre>
  
  <p>But i got this error: undefined index user user, in this line: <code>if(($_SESSION["user"]) and ($_SESSION["pass"]))</code></p>
  
  <p>Anyone know what im doing wrong?</p>