title: no change to the page after clicking log in button?
body: <p>creating a log in page using php and PDO however once I fill out the form with the correct username and password to log into the system and click log in, nothing changes except the boxes are now empty as if I never entered a username and password, can someone advise me as to what is going wrong?</p>
  
  <p>this is the php code: </p>
  
  <pre><code>&lt;?php
  
  session_start();
  $server = "127.0.0.1";
  $dbusername = "root";
  $dbpassword = "";
  $db = "movie1";
  $message = "";
  try
  {
      $handle = new PDO("mysql:host=$server; dbname=$db", $dbusername, $dbpassword);
      $handle-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      if(isset($_POST["login"]))
      {
          if(empty($_POST["username"]) || empty($_POST["password"]))
          {
              $message = '&lt;label&gt;All fields are required&lt;/label&gt;';
          }
          else
          {
              $query = "SELECT * FROM register WHERE username = :username AND password = :password";
              $statement = $handle-&gt;prepare($query);
              $statement-&gt;execute(
                  array(
                      'username'     =&gt;     $_POST["username"],
                      'password'     =&gt;     $_POST["password"]
                  )
              );
              $count = $statement-&gt;rowCount();
              if($count &gt; 0)
              {
                  $_SESSION["username"] = $_POST["username"];
                  header("location:login_success.php");
              }
              else
              {
                  $message = 'Wrong Data';
              }
          }
      }
  }
  catch(PDOException $error)
  {
      $message = $error-&gt;getMessage();
  }
  ?&gt;
  </code></pre>
  
  <p>and this is the html form to which it applies to: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;log in&lt;/title&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"&gt;
  &lt;body&gt;
  
  &lt;form class="w3-container w3-card-4" action="login.php" method="post"&gt;
      &lt;h2 class="w3-text-black"&gt;Log in&lt;/h2&gt;
      &lt;?php
      if(isset($message))
      {
          echo '&lt;label class "text-danger"&gt;'.$message.'&lt;/label&gt;';
      }
          ?&gt;
  
      &lt;p&gt;
          &lt;label class="w3-text-black"&gt;&lt;b&gt;username&lt;/b&gt;&lt;/label&gt;
          &lt;input class="w3-input w3-border" name="username" type="text" placeholder="username"&gt;&lt;/p&gt;
      &lt;p&gt;
          &lt;label class="w3-text-black"&gt;&lt;b&gt;Password&lt;/b&gt;&lt;/label&gt;
          &lt;input class="w3-input w3-border" name="password" type="text" placeholder="********"&gt;&lt;/p&gt;
      &lt;p&gt;
          &lt;input type="submit" name="login" class="w3-btn w3-black"&gt;Log in&lt;/input&gt;
      &lt;/p&gt;
  
      &lt;p&gt;
  </code></pre>
  
  <p>please ignore that passwords are not hashed, I will fix that later. the first image is what the log in form looks like with information entered and the next will be what happens after I click log in (pic one)<a href="https://i.stack.imgur.com/VAHHY.png" rel="nofollow noreferrer">1</a></p>
  
  <p>pic two <a href="https://i.stack.imgur.com/HUovH.png" rel="nofollow noreferrer">2</a></p>