title: no output from php script
body: <p>I have a <code>username</code> and <code>password</code> box and a <code>login</code> button. My <code>php</code> script should check if the boxes are empty and if the length of whats passed in is less than 6 characters. It is not doing what I want it to do and I am not sure why. I am new to php so I am using <code>W3 Schools</code> as reference but cant seem to figure out. I will past the code down below.</p>
  
  <pre><code>&lt;?php
  
  if($_POST){
  
  #not empty
  #atleast 6 characters long
  
  
  # array holds errors
  $errors = array();
  
  # validation starts here
  if(empty($_POST['uname'])){
      $errors['$uname1'] = "Your name cannot be empty";
  }
  
  if(strlen($_POST['uname']) &lt; 6){
      $errors['uname2'] = "Must be longer than 6 characters";
  }
  
  if(empty($_POST['psw'])){
      $errors['psw1'] = "Your password cannot be empty";
  }
  
  if(strlen($_POST['psw']) &lt; 6){
      $errors['psw2'] = "Must be longer than 6 characters";
  }
  
  
  if(count($errors) == 0){
  
      # redirect to the game page
      header('Location:success.html');
      exit();
  }
  }
  
  
  ?&gt;
  
  
  &lt;!DOCTYPE html&gt;
  
  &lt;head&gt;
      &lt;title&gt;Hangman Home Page&lt;/title&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;form action="" method="post" class="modal-content animate"&gt;
  
  
  
          &lt;div class="container"&gt;
              &lt;/p&gt;
  
              &lt;label for="uname"&gt;&lt;b&gt;Username&lt;/b&gt;&lt;/label&gt;
              &lt;input type="text" placeholder="Enter Username" name="uname"&gt;
              &lt;p&gt;
                  &lt;?php if(isset($errors['uname1'])) echo $errors['uname1'];  ?&gt;
              &lt;/p&gt;
              &lt;p&gt;
                  &lt;?php if(isset($errors['uname2'])) echo $errors['uname2'];  ?&gt;
              &lt;/p&gt;
  
  
              &lt;label for="psw"&gt;&lt;b&gt;Password&lt;/b&gt;&lt;/label&gt;
              &lt;input type="password" placeholder="Enter Password" name="psw"&gt;
              &lt;p&gt;
                  &lt;?php if(isset($errors['psw1'])) echo $errors['psw1'];  ?&gt;
              &lt;/p&gt;
              &lt;p&gt;
                  &lt;?php if(isset($errors['psw2'])) echo $errors['psw2'];  ?&gt;
              &lt;/p&gt;
  
              &lt;button type="submit" value="submit"&gt;Login&lt;/button&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>