title: server side php email validation not working
body: <p>I am practicing PHP and I created a signup form that performs client-side validation and also server-side. Javascript works perfectly and performs client-side but I removed all the javascript to see whether server-side works or not but it is not working and it submits the form without showing my errors.</p>
  
  <p>Here is the Server-side code:</p>
  
  <pre><code>if($_POST)
  {
  
      $query = "SELECT `email` FROM `users` where email =" . "'" . $_POST['Email'] . "'";
  
      $result = mysqli_query($db,$query);
  
      $row = mysqli_fetch_array($result);
  
      if($_POST['Email'] == $row['email'])
      {
  
          $error .= "This Email address is already registered with us";
  
      }
  
      if($error != "")
      {
  
          $error = '&lt;div class="alert alert-danger" role="alert"&gt;&lt;p&gt;There were error(s) in your form:&lt;/p&gt;' . $error . '&lt;/div&gt;';
  
      }
  }
  </code></pre>
  
  <p>Here is the form Code:</p>
  
  <pre><code>&lt;form method="post"&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label for="Email"&gt;Email address&lt;/label&gt;
                      &lt;input type="email" class="form-control" id="Email" name="Email" aria-describedby="emailHelp"&gt;
                      &lt;small id="emailHelp" class="form-text text-muted"&gt;We'll never share your email with anyone else.&lt;/small&gt;
                  &lt;/div&gt;
  &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>