title: How to validate email, password and confirm password?
body: <p><a href="https://i.stack.imgur.com/EnAuc.png" rel="nofollow noreferrer">Code of save.php</a></p>
  
  <p><a href="https://i.stack.imgur.com/lY0cS.png" rel="nofollow noreferrer">Code of the sign up form</a></p>
  
  <p>the codes are ok and i want to put some validation that says "Email has already been registered" and "your password doesnt match"
  this is the whole code for the sign up 
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;Index&lt;/title&gt;
    &lt;link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css"&gt;
    &lt;script src="bootstrap/jquery-3.1.1.min.js"&gt;&lt;/script&gt;
    &lt;script src="bootstrap/js/bootstrap.min.js"&gt;&lt;/script&gt;
   
   &lt;/head&gt;
   &lt;body&gt;
    &lt;nav class="navbar navbar-inverse" style="border-radius:0px 0px 0px 0px;"&gt;
     &lt;div class="container-fluid"&gt;
      &lt;div class="navbar-header"&gt;
       &lt;button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"&gt;
        &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
        &lt;span class="icon-bar"&gt;&lt;/span&gt;
        &lt;span class="icon-bar"&gt;&lt;/span&gt;
        &lt;span class="icon-bar"&gt;&lt;/span&gt;
       &lt;/button&gt;
       &lt;a class="navbar-brand" href="#"&gt;JMK Sounds &amp; Light&lt;/a&gt;
      &lt;/div&gt;
      &lt;div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"&gt;
       &lt;ul class="nav navbar-nav"&gt;
        &lt;li&gt;&lt;a href="index.php"&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li class="dropdown"&gt;
         &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;Equipments &lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
         &lt;ul class="dropdown-menu"&gt;
          &lt;li&gt;&lt;a href="soundsys.php"&gt;Sound System&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="lights.php"&gt;Lights&lt;/a&gt;&lt;/li&gt;
         &lt;/ul&gt;
         &lt;li&gt;&lt;a href="about.php"&gt;About&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href="contact.php"&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
        &lt;/li&gt;
       &lt;/ul&gt;
       
       &lt;div class="collapse navbar-collapse pull-right" id="bs-example-navbar-collapse-1"&gt;
       &lt;ul class="nav navbar-nav"&gt;
        &lt;li class="dropdown"&gt;
         &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;Sign in | Sign up &lt;span class="caret" &gt;&lt;/span&gt;&lt;/a&gt;
         &lt;ul class="dropdown-menu" style="padding:5px;"&gt;
             &lt;li&gt;
              &lt;div class="form-group"&gt;
               &lt;input type="text" class="form-control input-sm" placeholder="Username" style="margin-bottom:5px;" required/&gt;
            &lt;input type="text" class="form-control input-sm" placeholder="Password" style="margin-bottom:5px;" required/&gt;
            &lt;center&gt;&lt;button class="btn btn-primary btn-sm"&gt;Sign in&lt;/button&gt;&lt;/center&gt;
           &lt;/div&gt;
             &lt;/li&gt;
                &lt;center&gt;&lt;button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#signup"&gt;Sign Up&lt;/button&gt;&lt;/center&gt;
           &lt;li&gt;
            &lt;form class="navbar-form navbar-right" action="header.php" method="post"&gt;
            &lt;/form&gt;
           &lt;/li&gt;
         &lt;/ul&gt;
        &lt;/li&gt;
       &lt;/ul&gt;
       &lt;/li&gt;
       &lt;/ul&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/nav&gt;
    
    &lt;div class="modal fade" id="signup" tabindex="-1" role="dialog"&gt;
     &lt;div class="modal-dialog modal-sm" role="document"&gt;
      &lt;div class="modal-content"&gt;
       &lt;div class="modal-header"&gt;
        &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt; &amp;times; &lt;/span&gt;&lt;/button&gt;
        &lt;h4 class="modal-title"&gt;Sign Up&lt;/h4&gt;
       &lt;/div&gt;
       &lt;div class="modal-body"&gt;
        &lt;form action="save.php" method="post"&gt;     
         &lt;div class="form-group"&gt;
            
          &lt;input type="text" name="fname" class="form-control input-sm" placeholder="First Name" required/&gt;&lt;br /&gt;
          &lt;input type="text" name="sname" class="form-control input-sm" placeholder="Last Name" required/&gt;&lt;br /&gt;
          &lt;center&gt;
           &lt;input type="radio" name="gender" value="Male" required&gt; Male &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
           &lt;input type="radio" name="gender" value="Female" required&gt; Female&lt;br /&gt;&lt;br /&gt;
          &lt;/center&gt;
          &lt;input type="text" name="address" class="form-control input-sm" placeholder="Address" required/&gt;&lt;br /&gt;
          &lt;input type="text" name="contact" class="form-control input-sm" placeholder="+639" required/&gt;&lt;br /&gt;
          &lt;input type="text" name="email" class="form-control input-sm" placeholder="Email" required/&gt;&lt;br /&gt;
          &lt;input type="text" name="uname" class="form-control input-sm" placeholder="Username" required/&gt;&lt;br /&gt;
          &lt;input type="password" name="pword" class="form-control input-sm" placeholder="Password" required/&gt;&lt;br /&gt;
          &lt;input type="password" name="cpword" class="form-control input-sm" placeholder="Confirm Password" required/&gt;&lt;br /&gt;
          &lt;button type="button" class="btn btn-default btn-sm" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;button type="submit" name="submit" class="btn btn-primary btn-sm"&gt;Submit&lt;/button&gt;
       
  
         &lt;/div&gt;
        &lt;/form&gt;
       &lt;/div&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>