title: using php to login, when the user click the submit button it still directs the user to my connectivity.php
body: <p>As the title states when the user clicks the submit button it will take the suer to a blank connectivity.php page. The problem is however it works perfectly if the user enters their username and password. If they leave it blank thats when i goes to the blank connectivity page. Im having problems throwing up an error message.</p>
  
  <p>nav.php(nav bar)</p>
  
  <pre><code>&lt;div id="Sign-In"&gt;
                  &lt;form class="navbar-form navbar-right"  method="POST" action="Login/connectivity.php"&gt;
                      &lt;div class="form-group"&gt;
                          &lt;input type="text" class="form-control" placeholder="Username" name="user" side="40"&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;input type="text" class="form-control" placeholder="Password"  name="pass" side="40"&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;button type="submit" class="btn btn-success" name="submit" value="Log-In"&gt;Log In&lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
                  &lt;/div&gt;
  </code></pre>
  
  <p>nav.php cont</p>
  
  <pre><code>&lt;?php
  if ($_POST["submit"]) {
      if(!$_POST["user"]) {
  
              $error.="&lt;br /&gt;Please enter your username";
  
          }
      if(!$_POST["pass"]) {
  
              $error.="&lt;br /&gt;Please enter your Password";
  
          } 
      if($error){
  
          $result ='&lt;div class="alert alert-danger"&gt;&lt;strong&gt;There were error(s) in your form:&lt;/strong&gt; '.$error.'&lt;/div&gt;';
  
          } 
  }
  ?&gt;
  </code></pre>
  
  <p>I would like the div to pop up if its missing information. before it heads to <code>connectivity.php</code></p>
  
  <p>To better ask the question. I would like when the user presses to log-in button, the script at the top runs, IF the form is missing data the  wont run UNTIL they add the missing information, THEN the  will run.</p>