title: Form action not working in php?
body: <p>I have basically 2 forms in one page.
  First one is for login and second one is for insert data.
  Second form action is working fine. i can insert data with it.
  But same form I'm using for login user but it's not working.
  On click submit button nothing happens just page refresh.</p>
  
  <p>please see my code and help me to solve my first form's action issue.</p>
  
  <pre><code>&lt;div class="login_wrapper"&gt;
    &lt;div id="login" class="animate form login_form"&gt;
      &lt;section class="login_content"&gt;
        &lt;form action="login.php" method="post"&gt;
          &lt;h1&gt;Login Form&lt;/h1&gt;
          &lt;div&gt;
            &lt;input type="text" class="form-control" placeholder="Username" required=""  name="username" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;input type="password" class="form-control" placeholder="Password" required="" name="password" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;input type="submit" class="btn btn-default" name="insert" value="Sign In"&gt;
            &lt;a class="reset_pass" href="#forgetpass"&gt;Lost your password?&lt;/a&gt;
          &lt;/div&gt;
          &lt;div class="clearfix"&gt;&lt;/div&gt;
          &lt;div class="separator"&gt;
            &lt;p class="change_link"&gt;New to site?
              &lt;a href="#signup" class="to_register"&gt; Create Account &lt;/a&gt;
            &lt;/p&gt;
  
            &lt;div class="clearfix"&gt;&lt;/div&gt;
            &lt;br /&gt;
  
            &lt;div&gt;
              &lt;h1&gt;&lt;i class="fa fa-paw"&gt;&lt;/i&gt; DiGItal Society&lt;/h1&gt;
              &lt;p&gt;©2016 All Rights Reserved. DiGItal Society is a Web Portal for E-Society. Privacy and Terms&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/form&gt;            
      &lt;/section&gt;
    &lt;/div&gt;
  
    &lt;div id="register" class="animate form registration_form"&gt;
      &lt;section class="login_content"&gt;
        &lt;form action="insertUser.php" method="post"&gt;
          &lt;h1&gt;Create Account&lt;/h1&gt;
          &lt;div&gt;
            &lt;input type="text" class="form-control" placeholder="Username" required="" name="username" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;input type="email" class="form-control" placeholder="Email" required="" name="email" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;input type="password" class="form-control" placeholder="Password" required="" name="password" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;input type="hidden" name="roleid" value=""&gt;
            &lt;input type="submit" class="btn btn-default" name="insert" value="Log In"&gt;
          &lt;/div&gt;
  
          &lt;div class="clearfix"&gt;&lt;/div&gt;
  
          &lt;div class="separator"&gt;
            &lt;p class="change_link"&gt;Already a member ?
              &lt;a href="#signin" class="to_register"&gt; Log in &lt;/a&gt;
            &lt;/p&gt;
  
            &lt;div class="clearfix"&gt;&lt;/div&gt;
            &lt;br /&gt;
  
            &lt;div&gt;
              &lt;h1&gt;&lt;i class="fa fa-paw"&gt;&lt;/i&gt; DiGItal Society&lt;/h1&gt;
              &lt;p&gt;©2016 All Rights Reserved. DiGItal Society is a Web Portal for E-Society. Privacy and Terms&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/form&gt;
      &lt;/section&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have also add my action pages.(not working).
  <code>login.php</code> for first form(not working)</p>
  
  <pre><code>&lt;?php
  include 'db.php';
  if (isset($_REQUEST['insert'])) 
      {
      echo    $username = $_REQUEST['username'];
  
      echo    $password = $_REQUEST['password'];
          $sql = mysqli_query($conn,"SELECT * FROM `accountants` where `acc_email` = '$username' AND `acc_pass` = '$password'");
          $data = mysqli_fetch_array($conn,$sql);
          $_SESSION['role']=$data['roleId'];
          $_SESSION['username']=$data['acc_name'];
          $data = mysqli_num_rows($data);
          if ($data&gt;0) 
              {
                  header('Location: home.php');
              }
          else
              {
                  header('Location: index.php');
                  echo 'incorrect login';
              }
      }
  ?&gt;
  </code></pre>
  
  <p>and <code>insertUser.php</code> for second form.(working)</p>
  
  <pre><code>&lt;?php
  include 'db.php';
  if (isset($_REQUEST['insert'])) 
      {
          $acc_name = $_REQUEST['username'];
          $acc_email = $_REQUEST['email'];
          $acc_pass = $_REQUEST['password'];
          $role_id = $_REQUEST['roleid'];
          $sql = mysqli_query($conn,"INSERT INTO `accountants`(`acc_name`, `acc_email`, `acc_pass`, `roleId`) VALUES ('".$acc_name."','".$acc_email."','".$acc_pass."','2')");
          if ($sql&gt;0) 
              {
                  header('Location: home.php');
                  echo 'data added successfully';
              }
          $row = mysqli_query('SELECT * FROM `accountants`');     
          $data = mysqli_fetch_array($row);
          $data = mysqli_num_rows($conn,$data);
          $_SESSION['role'] = $data['roleId'];
      }
  ?&gt;
  </code></pre>