title: Notice: Undefined index: username on line 10
body: <p>I get this error when I ran my php code! any help on what I need to do to fix it? </p>
  
  <blockquote>
    <p>Notice: Undefined index: username in C:\xampp\htdocs\Slamza\login.php
    on line 10</p>
    
    <p>Notice: Undefined index: password in C:\xampp\htdocs\Slamza\login.php
    on line 11</p>
  </blockquote>
  
  <p>My code is </p>
  
  <pre><code>    &lt;?php
  
  session_start();
  
  
  
  $username = $_SESSION['username'];
  
  
  $username = $_POST['username'];
  $password = $_POST['password'];
  
  include("connect.php");
  
  if ($username &amp;&amp; $password)
  
  {
  
  
  $queryget = mysql_query("SELECT * FROM users WHERE username='$username' AND     password='$password'");
  $numrows = mysql_num_rows($queryget);
  if ($numrows != 0) 
  
  {
  
  
      $_SESSION['username'] = $username;
  
      echo "You have been logged in!";
  
  
  }
  
  
  else
  
  {
  
      echo "You have not been logged in";
  
  }
  
  
  
  
  
  }
  
  else
  
  {
  
  echo "You didn't provide the information needed to login";
  include("index.php");
  
  }
  
  ?&gt;
  </code></pre>