title: loading blank page despite form action location upon error
body: <p>I am creating a simple form that a user submits and email. I am trying to pose an error if the form is blank or it's not a valid email and if successful, then reload the page with a success message.</p>
  
  <p>When I submit blank it reloads the page without an error, and if I enter anything in ( valid or invalid email ) it reloads the page white, despite the form action being correct. I've been stuck on this and need help. Thanks.</p>
  
  <pre><code> &lt;?php
      require_once($_SERVER['DOCUMENT_ROOT'] . '/includes/system/init.php');
  
      if(isset($_POST['submit'])) {
  
          $email = $_POST['email'];
          if(empty($_POST['email']) || !filter_var($email, FILTER_VALIDATE_EMAIL)) { 
  
              $error = "Please enter a valid email";
  
          }else{
              $success = true;    
  
              mysql_query("INSERT INTO survey 
                  (email) VALUES('".$_POST['email']."' ) ") 
                  or die(mysql_error());  
          }
      }
  
  
      ?&gt;
  
  &lt;div class="email-survey"&gt;
              &lt;?php if(isset($success)) { ?&gt;
              &lt;div class="success"&gt;Thank You!&lt;/div&gt;
              &lt;?php } ?&gt;
  
              &lt;?php if(isset($error)) { ?&gt;
              &lt;div class="error"&gt;
                  &lt;?php echo $error; ?&gt;
              &lt;/div&gt;
              &lt;?php } ?&gt;
  
               &lt;form name="settings" action="/survey-confirm.php" method="post"&gt;
                  &lt;input type="text" name="email" /&gt; &lt;br /&gt;
                  &lt;input type="submit" name="submit" value="submit" /&gt;
               &lt;/form&gt;
          &lt;/div&gt;
  </code></pre>