title: Verification ignored in my registration form.
body: <p>I am try to verify fields in the registration form the (password match) the UserID is not taken and the email too.</p>
  
  <p>This is my code</p>
  
  <pre><code>&lt;?php
      if(isset($_POST['submit'])){
          $msg="";
          $id="";
          $name=$_POST['cName'];
          $address=$_POST['cAddrss'];
          $country=$_POST['cCountry'];
          $mobil=$_POST['cTel'];
          $sex=$_POST['cSex'];
          $email=$_POST['cEmail'];
          $userName=$_POST['cUsername'];
          $userPassword=$_POST['cPassword'];
          $confPassword=$_POST['concPassword'];
  
          $checkEmail=$db-&gt;query("select * from users where email ='".$email."'");
          $checkUID=$db-&gt;query("select * from users where user_name ='".$userName."'");
  
          if($userPassword !== $confPassword)
          {
              $msg="Password don't match";
          }
          if($checkEmail -&gt; num_rows == 1)
          {
              $msg = "&lt;span style='color:#F00; font-size:14px; font-weight:bold;'&gt;This email already taken&lt;/span&gt;";
          }
          if($checkUID -&gt; num_rows == 1) 
          {
              $msg = "&lt;span style='color:#F00; font-size:14px; font-weight:bold;'&gt;This User name already taken&lt;/span&gt;";
          }
          if($put=$db-&gt;prepare("INSERT INTO users(id, name, mobile, sex, country, address, user_name, user_password, email)VALUE(?, ?, ?, ?, ?, ?, ?, ?, ?)"))
              {
                  $put-&gt;bind_param('issssssss', $id, $name, $mobil, $sex, $country, $address, $userName, $userPassword, $email);
                  $put-&gt;execute();
                  $put-&gt;close();
              }
              else
              {
                  die($db-&gt;error);
              }
              header("Location:index.php?pid=3&amp;smsg=smsg");
          }
  ?&gt;
  </code></pre>
  
  <p>What happens is the form ignores my Verification and jump to the header and send me to the success page as an everything is fine.</p>
  
  <p>At the top of my form I used this to show the <code>$msg</code> if there is any <code>&lt;?php if(!empty($msg)) {echo $msg;} ?&gt;</code></p>