title: How to fix this login form in PHP
body: <p>Please help me.</p>
  
  <p>When I input the correct username and password nothing happens If i put in an incorrect combo it outputs:</p>
  
  <blockquote>
    <p><b>Invalid Username or Password..</b></p>
  </blockquote>
  
  <p>Please help me to fix this, here's the code:</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['submit']))
  {
  $Username=$_POST["user"];  //variable declaration for Username
      $Password=$_POST["pass"];  //variable declaration for Password(Encrypted)
  
      $query2 = "SELECT * FROM admin WHERE username1='$Username' and pasword2='$Password'";  // . this is correct dont worry about this
      $result = mysql_query($query2);  //execute query
      $host    = "localhost"; // Host name
      $db_name = "db_login";      // Database name
      $db_user = "root";      // Database user name
      $db_pass = "";      // Database Password
          // Table column from which suggestions will get shown
  
      $conn = mysql_connect($host,$db_user,$db_pass)or die(mysql_error());
      mysql_select_db($db_name,$conn)or die(mysql_error());
  
      $count = mysql_num_rows($result);  //no of data found
      $row = mysql_fetch_array($result, MYSQL_NUM); //rows no.
      if($row)
      {
          session_start();
          $USW=$_SESSION["username1"] = $row[2];
          $_SESSION["usertype"] = $row[4];        
          $ui=$_SESSION["Id"] = $row[0];
                                  $row[4];            
      }
              $Us=$_POST['user'];
             $Up=$_POST['pass'];
        if($count == 1)  //if data found is 1
      {
          if($row[4] == "admin") //then if user type is admin
          {
  
              header("location:Admin/Home.php?ui=$ui");
          }
          else  //if not
          {
  
              header("location:user/index.php?ui=$ui");
          }
      }
      else //if data is not found or greater than 1
      {
  
          echo '&lt;b style="color:red;"&gt;Invalid Username or Password&lt;/b&gt;&lt;br&gt;';
          echo '&lt;b style="color:white;"&gt;Please try again..&lt;/b&gt;';
          header("index.php");
      }
  }
  ?&gt;
  </code></pre>
  
  <p>help me to fix the login if the input password and username is correct</p>