title: Show pop up after submit form
body: <p>can anyone help me, I want the result of php to be displayed in pop up form on the same html page, how can that do? this is my code
  thank you all for help</p>
  
  <p>index.html</p>
  
  <pre><code>        &lt;!-- Start Contact Form --&gt;
      &lt;div class="triangle"&gt;&lt;/div&gt;
      &lt;div id="cform" class="container"&gt;
          &lt;div class="row"&gt;
              &lt;h3 class="my-title contact-title"&gt;Kontaktformular&lt;/h3&gt;
              &lt;hr&gt;
              &lt;div class="col-md-12"&gt;
                  &lt;form id="my-form" method="post" action="handler.php"&gt;
                      &lt;ul class="contact-form"&gt;
                          &lt;li&gt;
                              &lt;div class="col-md-6"&gt;
                                  &lt;input name="name" placeholder="Name" required="required" size="8" type="text"&gt;
                              &lt;/div&gt;
  
                              &lt;div class="col-md-6"&gt;
                                  &lt;input name="email" placeholder="E-Mail" required="required" size="8" type="email"&gt;
                              &lt;/div&gt;
                          &lt;/li&gt;
  
                          &lt;li&gt;
                              &lt;div class="col-md-6"&gt;
                                  &lt;input name="telefon" placeholder="Telefon" size="8" type="text"&gt;
                              &lt;/div&gt;
  
                              &lt;div class="col-md-6"&gt;
                                  &lt;input name="firma" placeholder="Firma" size="8" type="text"&gt;
                              &lt;/div&gt;
                          &lt;/li&gt;
  
                          &lt;li&gt;
                              &lt;div class="col-md-6"&gt;
                                  &lt;label&gt;Ihr Budget&lt;/label&gt;
                                  &lt;div id="slider-range-min" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"&gt;
                                      &lt;div class="ui-slider-range ui-widget-header ui-corner-all ui-slider-range-min" style="width: 1%;"&gt;
                                          &lt;/div&gt;&lt;span class="ui-slider-handle ui-state-default ui-corner-all" tabindex="0" style="left: 8%;"&gt;&lt;/span&gt;&lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="col-md-6"&gt;
                                  &lt;input name="amount" id="amount" readonly&gt;
                              &lt;/div&gt;
                          &lt;/li&gt;
  
                          &lt;li&gt;
  
                              &lt;div class="col-md-12"&gt;
                                  &lt;textarea class="span12" name="details" placeholder="Ihre Projektbeschreibung" required="required"&gt;&lt;/textarea&gt;
                              &lt;/div&gt;
                          &lt;/li&gt;
  
                          &lt;li&gt;
                              &lt;div class="col-md-12"&gt;
                                  &lt;button id="my-btn" type="submit"&gt;Senden &lt;span class="glyphicon glyphicon-arrow-right" aria-hidden="true"&gt;&lt;/span&gt;&lt;/button&gt;
                                  &lt;span id="status"&gt;&lt;/span&gt;
                              &lt;/div&gt;
                          &lt;/li&gt;
  
  
                      &lt;/ul&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;!-- End Contact Form --&gt;
  </code></pre>
  
  <p>handler.php</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['email'])) {
  
      // EDIT THE 2 LINES BELOW AS REQUIRED
      $email_to = "info@test.com";
      $email_subject = "Your email subject line";
  
      function died($error) {
          // your error code can go here
          echo "We are very sorry, but there were error(s) found with the form you submitted. ";
          echo "These errors appear below.&lt;br /&gt;&lt;br /&gt;";
          echo $error."&lt;br /&gt;&lt;br /&gt;";
          echo "Please go back and fix these errors.&lt;br /&gt;&lt;br /&gt;";
          die();
      }
  
  
      // validation expected data exists
      if(!isset($_POST['name']) ||
          !isset($_POST['email']) ||
          !isset($_POST['telefon']) ||
          !isset($_POST['firma']) ||
          !isset($_POST['amount']) ||
          !isset($_POST['details'])) {
          died('We are sorry, but there appears to be a problem with the form you submitted.');       
      }
  
  
  
      $first_name = $_POST['name']; // required
      $email_from = $_POST['email']; // required
      $firma = $_POST['firma']; // required
      $telephone = $_POST['telefon']; // not required
      $amount = $_POST['amount'];
      $comments = $_POST['details']; // required
  
      $error_message = "";
      $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  
    if(!preg_match($email_exp,$email_from)) {
      $error_message .= 'The Email Address you entered does not appear to be valid.&lt;br /&gt;';
    }
  
      $string_exp = "/^[A-Za-z .'-]+$/";
  
    if(!preg_match($string_exp,$first_name)) {
      $error_message .= 'The First Name you entered does not appear to be valid.&lt;br /&gt;';
    }
  
    if(!preg_match($string_exp,$firma)) {
      $error_message .= 'The Last Name you entered does not appear to be valid.&lt;br /&gt;';
    }
  
    if(strlen($comments) &lt; 2) {
      $error_message .= 'The Comments you entered do not appear to be valid.&lt;br /&gt;';
    }
  
    if(strlen($error_message) &gt; 0) {
      died($error_message);
    }
  
      $email_message = "Form details below.\n\n";
  
  
      function clean_string($string) {
        $bad = array("content-type","bcc:","to:","cc:","href");
        return str_replace($bad,"",$string);
      }
  
  
  
      $email_message .= "First Name: ".clean_string($first_name)."\n";
  
      $email_message .= "Email: ".clean_string($email_from)."\n";
      $email_message .= "Telephone: ".clean_string($telephone)."\n";
      $email_message .= "Firma: ".clean_string($firma)."\n";
      $email_message .= "Amount: ".clean_string($amount)."\n";
      $email_message .= "Comments: ".clean_string($comments)."\n";
  
  // create email headers
  $headers = 'From: '.$email_from."\r\n".
  'Reply-To: '.$email_from."\r\n" .
  'X-Mailer: PHP/' . phpversion();
  @mail($email_to, $email_subject, $email_message, $headers);  
  
  
  ?&gt;
  
  &lt;!-- include your own success html here --&gt;
  
  
  Thank you for contacting us. We will be in touch with you very soon.
  
  
  &lt;?php
  
  }
  ?&gt;
  </code></pre>
  
  <p>I apologize for the fact that I put the php code in the snippet, I could not possibly put it differently, but I think it is as clear as that.</p>
  
  <p>At the moment when I send the form I get on the second page ie handler.php answer that the form is sent ("Thank you for contacting us. We will be in touch with you very soon.")</p>