title: Bootstrap contact form module issue
body: <p>I am having trouble with getting this code to not show a thank you modul for incomplete submissions. I also would like the page redirect to originating page(with a pop up modul for either confirmation or error on the page in a modul would be optimal) or just redirect to the originating page without having to create a new PHP file for every page a contact form is on. I have several.</p>
  
  <p>The way it is now it can send mail but it directs to a blank white page with just type on it, and a request to use the browser back button to return to originating page. Also it fires the (Thank you)modul even if in put is in correct. would it please be possible to get help with this?</p>
  
  <pre><code>&lt;form class="o-form" id="contactForm" action="php/contact.php" method="post"&gt;
                            &lt;input type="email" name="senderEmail" id="senderEmail" required="required" placeholder="email"&gt;
                             &lt;textarea name="message" id="message" required="required placeholder="message"&gt;&lt;/textarea&gt;
                            &lt;input type="submit" value="send" class="send-button"&gt;
                        &lt;/form&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="copyright"&gt;
           &lt;span&gt;
             anthonygallina
           &lt;/span&gt;
        &lt;/div&gt;
     &lt;/footer&gt;
     &lt;div class="th-popup"&gt;
         &lt;div class="massage-th"&gt;
             &lt;h1&gt;Thank You!&lt;/h1&gt;
             &lt;p&gt;We apreciate your visit to our home page. We will contact you soon!&lt;/p&gt;
         &lt;/div&gt;
     &lt;/div&gt;
  
  &lt;script src="js/jquery-1.11.1.min.js"&gt;&lt;/script&gt;
  &lt;script src="js/all.js"&gt;&lt;/script&gt;
  &lt;script src="js/jquery.mixitup.min.js"&gt;&lt;/script&gt;
  &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script src="js/idangerous.swiper.min.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;?php
  </code></pre>
  
  <p>And the other part</p>
  
  <pre><code>// Define some constants
  define( "RECIPIENT_NAME", "YOURNAME" );
  define( "RECIPIENT_EMAIL", "YOUR@EMAIL.net" );
  define( "EMAIL_SUBJECT", "Visitor Message" );
  
  // Read the form values
  $success = false;
  $senderEmail = isset( $_POST['senderEmail'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail'] ) : "";
  $message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";
  
  // If all values exist, send the email
  if ( $senderEmail &amp;&amp; $message ) {
    $recipient = RECIPIENT_NAME . " &lt;" . RECIPIENT_EMAIL . "&gt;";
    $headers = "From: " . $senderEmail . " &lt;" . $senderEmail . "&gt;";
    $success = mail( $recipient, EMAIL_SUBJECT, $message, $headers );
  }
  
  // Return an appropriate response to the browser
  if ( isset($_GET["ajax"]) ) {
    echo $success ? "success" : "error";
  } else {
  ?&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Thanks!&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;?php if ( $success ) echo "&lt;p&gt;Thanks for sending your message! We'll get back to you soon.&lt;/p&gt;" ?&gt;
    &lt;?php if ( !$success ) echo "&lt;p&gt;There was a problem sending your message. Please try again.&lt;/p&gt;" ?&gt;
    &lt;p&gt;Click your browser's Back button to return to the page.&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>