title: Login and Create Account HTML Forms in One Div
body: <p>I have two forms that are specified in one div. One is for login and the other is for create account. The login form works well but the create account button gives the login error even though it is to call the create-account.php file.</p>
  
  <p>Below we have the code.</p>
  
  <p>the login  create / account forms</p>
  
  <pre><code>&lt;?php
  include('login.php'); // Includes Login Script
  
  if(isset($_SESSION['login_user'])){
  header("location: index.php");
  }
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Login&lt;/title&gt;
  &lt;link href="style.css" rel="stylesheet" type="text/css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="main"&gt;
  &lt;div id="login"&gt;
  &lt;h2&gt;Login Form&lt;/h2&gt;
  &lt;form action="" method="post"&gt;
  &lt;label&gt;UserName :&lt;/label&gt;
  &lt;input id="name" name="username" placeholder="username" type="text"&gt;
  &lt;label&gt;Password :&lt;/label&gt;
  &lt;input id="password" name="password" placeholder="**********" type="password"&gt;
  &lt;input name="submit" type="submit" value=" Login "&gt;
  
  &lt;span&gt;&lt;?php echo $error; ?&gt;&lt;/span&gt;
  &lt;/form&gt;
  
  &lt;form action="create-account.php" method="post" &gt;
  &lt;input name="submit" type="submit" value=" Create User "&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the login.php code is given below</p>
  
  <pre><code>&lt;?php
  include('config2.php');
  
  session_start(); // Starting Session
  
  $error=''; // Variable To Store Error Message
  
  if (isset($_POST['submit'])) {
  if (empty($_POST['username']) || empty($_POST['password'])) {
  $error = "Username or Password is invalid";
  }
  else
  {
  // Define $username and $password
  $username=$_POST['username'];
  $password=$_POST['password'];
  
  // Create connection
  $con = mysqli_connect($db_hostname, $db_username, $db_password, $db_database , 3306);
  
  
  // Check connection
      if(mysqli_connect_error()){
   die("Connection failed: ".$con-&gt;connect_error);
                               }
  
  // To protect MySQL injection for Security purpose
  $username = stripslashes($username);
  $password = stripslashes($password);
  //$username = mysql_real_escape_string($username);
  //$password = mysql_real_escape_string($password);
  
  
  // Retrieve data from database
  
  $sql="select * from admin where password='$password' AND user_name='$username'";
  
  $result = mysqli_query($con,$sql);
  
  $rows = mysqli_num_rows($result); 
  
  
  echo sizeof($rows);
  
  if($rows == 1) {
  $_SESSION['login_user']=$username; // Initializing Session
  header("location: profile.php"); // Redirecting To Other Page
  } else {
  $error = "Username or Password is invalid";
  }
  
  $con-&gt;close(); // Closing Connection
  }
  }
  
  ?&gt;
  </code></pre>
  
  <p>The create-account.php file has no codes.
  Any suggestion. </p>