title: Bootstrap Modal not opening on form submit
body: <p><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;div class="col-lg-10 col-lg-offset-1 text-center"&gt;
    &lt;form method="POST" action="index.php" accept="text/html" formenctype="multipart/form-data" class="contact-form row"&gt;
      &lt;div class="col-md-4"&gt;
        &lt;label&gt;&lt;/label&gt;
        &lt;input name="name" type="text" class="form-control" placeholder="Name"&gt;
      &lt;/div&gt;
      &lt;div class="col-md-4"&gt;
        &lt;label&gt;&lt;/label&gt;
        &lt;input name="email" type="text" class="form-control" placeholder="Email"&gt;
      &lt;/div&gt;
      &lt;div class="col-md-4"&gt;
        &lt;label&gt;&lt;/label&gt;
        &lt;input name="subject" type="text" class="form-control" placeholder="Subject"&gt;
      &lt;/div&gt;
      &lt;div class="col-md-12"&gt;
        &lt;label&gt;&lt;/label&gt;
        &lt;textarea name="message" class="form-control" rows="9" placeholder="Your message here.."&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div class="col-md-4 col-md-offset-4"&gt;
        &lt;label&gt;&lt;/label&gt;
        &lt;button id="submit" name="submit" type="sumbit" data-toggle="modal" data-target="#alertModal" class="btn btn-primary btn-block btn-lg"&gt;Send &lt;i class="ion-android-arrow-forward"&gt;&lt;/i&gt;&lt;/button&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/section&gt;
  
  &lt;div id="alertModal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"&gt;
    &lt;div class="modal-dialog modal-sm"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-body"&gt;
          &lt;h2 class="text-center"&gt;Submitted sucessfully!&lt;/h2&gt;
          &lt;p class="text-center"&gt;You clicked the button&lt;/p&gt;
  
          &lt;br/&gt;
          &lt;button class="btn btn-primary btn-lg center-block" data-dismiss="modal" aria-hidden="true"&gt;OK &lt;i class="ion-android-close"&gt;&lt;/i&gt;&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <pre><code>&lt;?php
  $headers = ''; // added this line
  $headers. = "MIME-Version: 1.0\r\n";
  $headers. = "Content-type: text/html\r\n";
  $headers = 'From: $name'.
  "\r\n". // added .= instead of =
  
  'X-Mailer: PHP/'.phpversion();
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $from = 'From: '.$email;
  $to = 'random@gmail.com';
  $subject = $_POST['subject'];
  
  
  $body = " From: $name\n E-mail: $email\n Subject: $subject\n Message:\n $message";
  
  if (isset($_POST['submit'])) {
    /* Anything that goes in here is only performed if the form is submitted */
    if (mail('random@gmail.com', $subject, $body, $from)) {
      echo "&lt;script type='text/javascript'&gt;$(document).ready(function(){ $('#alertModal').modal('show');});&lt;/script&gt;";
    } else {
      echo "something went wrong";
    }
  } ?&gt;
  </code></pre>
  
  <p>I have been trying to call my modal when submitting my form, but cannot seem to get it to work.</p>
  
  <p>I have been looking at various different questions but nothing seems to work. </p>
  
  <p>I do not have JS for this and my PHP is incorporated on a separate page. </p>
  
  <p>Please help, I want the modal to open on the same page as the form when someone submits the info.</p>
  
  <p>Thanks</p>