title: Notice: Undefined index: username in C:\xampp\htdocs\index.php on line 4
body: <p>Hello All firstly I would like to thank you for your time, I am having to do this for college (web server scripting unit p4) this is my simple log in but cannot get it up and running keep getting the error message: Notice: Undefined index: username in C:\xampp\htdocs\index.php on line 4</p>
  
  <p>Here is my code: </p>
  
  <pre><code>&lt;?php
  session_start();
  
  if($_POST["username"]) {
  
      $dbUsname = "Stephen";
      $dbPassword = "Password123";
      $uid = "0001";
  
      $usname = strip_tags($_POST["username"]);
      $pass = strip_tags($_POST["password"]);
  
      if (username == $dbUsname &amp;&amp; $pass == $dbPassword) {
          $_SESSION["username"] = $usname;
          $_SESSION["id"] = $uid;
          header("Location; user.php");
          } else {
              echo"&lt;h2&gt;UH OH Oh no you didnt your password was incorrect.
              &lt;br&gt; /&gt; Enter that again.&lt;/h2&gt;";
          }
  }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;Basic Login System&lt;/title&gt;
  &lt;style type="text/css"&gt;
  html {
      font-family: Verdano, Genevo, sans-serif;
  }
  h1{
      font-size: 24px;
      text-align: center;
  }
  #wrapper {
      position: absolute;
      width: 100px;
      top: 30%;
      margin-top: -50%;
  }
  #form {
      margin: auto;
      width: 200px;
      height: 100px
  }
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="wrapper"&gt;
  &lt;h1&gt;Login&lt;/h1&gt;
  &lt;form id="form" action="index.php" method="post" enctype="multiport/form-data"&gt;
  Username: &lt;input type="text" name="username" /&gt; &lt;br&gt; /&gt;
  Password: &lt;input type="password" name="password" /&gt; /&gt;
  &lt;input type="submit" value="Login" name="Submit" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;  
  </code></pre>