title: Loading a php success message within a modal window same as the form
body: <p>Hello I'm trying to get my php form success (or error) message to load within the modal window that the form is actually in.  I would like to just have the form open in  the modal, without having to switch pages for any reason. I've been search S/O and couldn't find anything similar.  Maybe I'm not asking the right question...I don't know.  My code currently looks like:</p>
  
  <p>EDIT:  This is the code that works properly.  Needs to be styled still but it's functional.</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['email'])) {
  
      // EDIT THE 2 LINES BELOW AS REQUIRED
      $email_to = "webadmin@collegeboundparentnetwork.com";
      $email_subject = "Form Submission";
  
  
      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['first_name']) ||
          !isset($_POST['last_name']) ||
          !isset($_POST['email']) ||
          !isset($_POST['telephone']) ||
          !isset($_POST['comments'])) {
          died('We are sorry, but there appears to be a problem with the form you submitted.');       
      }
  
      $first_name = $_POST['first_name']; // required
      $last_name = $_POST['last_name']; // required
      $email_from = $_POST['email']; // required
      $telephone = $_POST['telephone']; // not required
      $comments = $_POST['comments']; // 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,$last_name)) {
      $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 .= "Last Name: ".clean_string($last_name)."\n";
      $email_message .= "Email: ".clean_string($email_from)."\n";
      $email_message .= "Telephone: ".clean_string($telephone)."\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;
   &lt;style&gt;
  
   &lt;/style&gt;
   &lt;div id="openModal" class="modalDialog"&gt;
                      &lt;div&gt;
                          &lt;a href="#close" title="Close" class="close"&gt;X&lt;/a&gt;
                          &lt;p id="p1"&gt;Message&lt;/p&gt;
  &lt;p style="font-size: 16px;"&gt;Thank you for contacting us. We will be in touch with you very soon.&lt;/p&gt;
  
  &lt;p style="font-size: 16px;"&gt;Click &lt;a href="index.html" style="text-decoration: none; color: green;"&gt;Here&lt;/a&gt; to return home.&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;?php
  }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;title&gt;College Bound Parent Network&lt;/title&gt;
          &lt;link rel="stylesheet" href="css/main_styles.css"&gt;
          &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt;
          &lt;!--[if IE]&gt;
              &lt;script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;
          &lt;![endif]--&gt;
          &lt;style&gt;
          form{margin-left: 80px; margin-right: 80px; text-align: left;}
          #p1 {text-align: left; margin-left: 80px;}
          .modalDialog {
              position: fixed;
              font-family: Arial, Helvetica, sans-serif;
              top: 0;
              right: 0;
              bottom: 0;
              left: 0;
              background: rgba(0,0,0,0.8);
              z-index: 99999;
              opacity:0;
              -webkit-transition: opacity 400ms ease-in;
              -moz-transition: opacity 400ms ease-in;
              transition: opacity 400ms ease-in;
              pointer-events: none;
          }
          .modalDialog:target {
              opacity:1;
              pointer-events: auto;
          }
  
          .modalDialog &gt; div {
              width: 800px;
              position: relative;
              margin: 10% auto;
              padding: 5px 20px 13px 20px;
              border-radius: 10px;
              background: #fff;
              background: -moz-linear-gradient(#fff, #999);
              background: -webkit-linear-gradient(#fff, #999);
              background: -o-linear-gradient(#fff, #999);
          }
          .close {
              background: #606061;
              color: #FFFFFF;
              line-height: 25px;
              position: absolute;
              right: -12px;
              text-align: center;
              top: -10px;
              width: 24px;
              text-decoration: none;
              font-weight: bold;
              -webkit-border-radius: 12px;
              -moz-border-radius: 12px;
              border-radius: 12px;
              -moz-box-shadow: 1px 1px 3px #000;
              -webkit-box-shadow: 1px 1px 3px #000;
              box-shadow: 1px 1px 3px #000;
          }
  
          .close:hover { background: #00d9ff; }
          &lt;/style&gt;        
      &lt;/head&gt;
      &lt;body class="no-js"&gt;
          &lt;div id="center_div"&gt;
              &lt;nav id="topNav"&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="student-athlete.html" title="Athletes"&gt;Athletes&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="student-music.html" title="Music"&gt;Music&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="testing.html" title="Testing"&gt;Testing&lt;/a&gt;&lt;/li&gt;
                      &lt;!--&lt;li&gt;&lt;a href="administration.html" title="Aministration"&gt;Administration&lt;/a&gt;&lt;/li&gt;--&gt;
                      &lt;li&gt;&lt;a href="advising.html" title="Advising"&gt;Advising&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="links.html" title="Useful Links"&gt;Links&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="contact.html" title="Contact CBPN"&gt;Contact&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/nav&gt;
              &lt;div id="header"&gt;&lt;a href="index.html"&gt;College Bound Parents Network&lt;/a&gt;&lt;/div&gt;
              &lt;hr id="hr"/&gt;
              &lt;div id="inner_article"&gt;
              &lt;/br&gt;
                  &lt;p id="p1"&gt;Welcome to CBPN College Recruiting&lt;/p&gt;
                  &lt;p&gt;
                      &amp;nbsp&amp;nbspFor the last 20 years our team has been involved working with college bound students
                      and their families.  Over the years not only cost of college has increased but also the
                      number of students applying for college has increased from 1.2 million to over 3 million a year in 2012.
                      Students who have an above averge GPA no longer can be assured of a seat at the college. Also affordability
                      is a key issue in determining which school that student attends.
                  &lt;/p&gt;
                  &lt;p&gt;
                      &amp;nbsp&amp;nbspUnderstanding the increase in the number of students who are now applying to college,  we have put together
                      a web site that assists college bound students and their families in the following ways: 
                      &lt;ul style="text-align: left; margin: 5px 15px 5px 15px;"&gt;
                          &lt;li&gt;1. Create an athletic recruitment tool where student athletes can actively promote themselves to college coaches;&lt;/li&gt;&lt;br/&gt;
                          &lt;li&gt;2. Help with recruitment for of musically talented students who want to continue to play in college.&lt;/li&gt;&lt;br/&gt;
                          &lt;li&gt;3. Offer an online test prep service to prepare students with both SAT/ACT. Too often students forget that they will not receive all their college money for their sports or music talent. We know test scores play a key role with merit aid.&lt;/li&gt;&lt;br/&gt;
                          &lt;li&gt;4. Offer an SAT/ACT diagnostic tool, so students can spend their time preparing for the right test: offer AP prep courses. Due to the importance of the SAT/ACT for acceptance and merit aid, we believe students should focus on the test that best suits their skills so using the diagnostic tool will help determine which test is best for each student.&lt;/li&gt;&lt;br/&gt;
                          &lt;/ul&gt;
                  &lt;/p&gt;
  
                  &lt;p&gt;
                      We hope you enjoy the tools offered and ask that you contact us at any time if you have any questions or concerns.
                  &lt;/p&gt;
  
  
                  &lt;p id="demo"&gt;
                  &lt;a href="#openModal"&gt;&lt;img src="/images/contact_us.jpg" align="center" title="Click to contact us!"/&gt;&lt;/a&gt;&lt;br/&gt;
                  &lt;figcaption&gt;Contact Us!&lt;/figcaption&gt;
                  &lt;br/&gt;&lt;br/&gt;
                  &lt;/p&gt;
                  &lt;div id="openModal" class="modalDialog"&gt;
                      &lt;div&gt;
                          &lt;a href="#close" title="Close" class="close"&gt;X&lt;/a&gt;
                          &lt;p id="p1"&gt;Contact Us&lt;/p&gt;
                  &lt;form id="frm1" name="contactform" method="post" action="&lt;?php $_SERVER['PHP_SELF']?&gt;"&gt;
                      &lt;table width="450px"&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="first_name"&gt;First Name *&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="first_name" maxlength="50" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top""&gt;
                        &lt;label for="last_name"&gt;Last Name *&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="last_name" maxlength="50" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="email"&gt;Email Address *&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="email" maxlength="80" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="telephone"&gt;Telephone Number&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="telephone" maxlength="30" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="comments"&gt;Comments*&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;textarea  name="comments" maxlength="1000" cols="60" rows="6" wrap="hard"&gt;Please provide grade level and type of assistance you are looking for.&lt;/textarea&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td colspan="2" style="text-align:center"&gt;
                        &lt;input type="submit" value="Submit"&gt; 
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/form&gt;
                      &lt;/div&gt;
  
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;  
          &lt;script src="js/jquery.js"&gt;&lt;/script&gt;
          &lt;script src="js/modernizr.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;title&gt;College Bound Parent Network&lt;/title&gt;
          &lt;link rel="stylesheet" href="css/main_styles.css"&gt;
          &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt;
          &lt;!--[if IE]&gt;
              &lt;script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;
          &lt;![endif]--&gt;
          &lt;style&gt;
          form{margin-left: 80px; margin-right: 80px; text-align: left;}
          #p1 {text-align: left; margin-left: 80px;}
          .modalDialog {
              position: fixed;
              font-family: Arial, Helvetica, sans-serif;
              top: 0;
              right: 0;
              bottom: 0;
              left: 0;
              background: rgba(0,0,0,0.8);
              z-index: 99999;
              opacity:0;
              -webkit-transition: opacity 400ms ease-in;
              -moz-transition: opacity 400ms ease-in;
              transition: opacity 400ms ease-in;
              pointer-events: none;
          }
          .modalDialog:target {
              opacity:1;
              pointer-events: auto;
          }
  
          .modalDialog &gt; div {
              width: 800px;
              position: relative;
              margin: 10% auto;
              padding: 5px 20px 13px 20px;
              border-radius: 10px;
              background: #fff;
              background: -moz-linear-gradient(#fff, #999);
              background: -webkit-linear-gradient(#fff, #999);
              background: -o-linear-gradient(#fff, #999);
          }
          .close {
              background: #606061;
              color: #FFFFFF;
              line-height: 25px;
              position: absolute;
              right: -12px;
              text-align: center;
              top: -10px;
              width: 24px;
              text-decoration: none;
              font-weight: bold;
              -webkit-border-radius: 12px;
              -moz-border-radius: 12px;
              border-radius: 12px;
              -moz-box-shadow: 1px 1px 3px #000;
              -webkit-box-shadow: 1px 1px 3px #000;
              box-shadow: 1px 1px 3px #000;
          }
  
          .close:hover { background: #00d9ff; }
          &lt;/style&gt;        
      &lt;/head&gt;
      &lt;body class="no-js"&gt;
          &lt;div id="center_div"&gt;
              &lt;nav id="topNav"&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="student-athlete.html" title="Athletes"&gt;Athletes&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="student-music.html" title="Music"&gt;Music&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="testing.html" title="Testing"&gt;Testing&lt;/a&gt;&lt;/li&gt;
                      &lt;!--&lt;li&gt;&lt;a href="administration.html" title="Aministration"&gt;Administration&lt;/a&gt;&lt;/li&gt;--&gt;
                      &lt;li&gt;&lt;a href="advising.html" title="Advising"&gt;Advising&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="links.html" title="Useful Links"&gt;Links&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="contact.html" title="Contact CBPN"&gt;Contact&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/nav&gt;
              &lt;div id="header"&gt;&lt;a href="index.html"&gt;College Bound Parents Network&lt;/a&gt;&lt;/div&gt;
              &lt;hr id="hr"/&gt;
              &lt;div id="inner_article"&gt;
              &lt;/br&gt;
                  &lt;p id="p1"&gt;Welcome to CBPN College Recruiting&lt;/p&gt;
                  &lt;p&gt;
                      &amp;nbsp&amp;nbspFor the last 20 years our team has been involved working with college bound students
                      and their families.  Over the years not only cost of college has increased but also the
                      number of students applying for college has increased from 1.2 million to over 3 million a year in 2012.
                      Students who have an above averge GPA no longer can be assured of a seat at the college. Also affordability
                      is a key issue in determining which school that student attends.
                  &lt;/p&gt;
                  &lt;p&gt;
                      &amp;nbsp&amp;nbspUnderstanding the increase in the number of students who are now applying to college,  we have put together
                      a web site that assists college bound students and their families in the following ways: 
                      &lt;ul style="text-align: left; margin: 5px 15px 5px 15px;"&gt;
                          &lt;li&gt;1. Create an athletic recruitment tool where student athletes can actively promote themselves to college coaches;&lt;/li&gt;&lt;br/&gt;
                          &lt;li&gt;2. Help with recruitment for of musically talented students who want to continue to play in college.&lt;/li&gt;&lt;br/&gt;
                          &lt;li&gt;3. Offer an online test prep service to prepare students with both SAT/ACT. Too often students forget that they will not receive all their college money for their sports or music talent. We know test scores play a key role with merit aid.&lt;/li&gt;&lt;br/&gt;
                          &lt;li&gt;4. Offer an SAT/ACT diagnostic tool, so students can spend their time preparing for the right test: offer AP prep courses. Due to the importance of the SAT/ACT for acceptance and merit aid, we believe students should focus on the test that best suits their skills so using the diagnostic tool will help determine which test is best for each student.&lt;/li&gt;&lt;br/&gt;
                          &lt;/ul&gt;
                  &lt;/p&gt;
  
                  &lt;p&gt;
                      We hope you enjoy the tools offered and ask that you contact us at any time if you have any questions or concerns.
                  &lt;/p&gt;
  
  
                  &lt;p id="demo"&gt;
                  &lt;a href="#openModal"&gt;&lt;img src="/images/contact_us.jpg" align="center" title="Click to contact us!"/&gt;&lt;/a&gt;&lt;br/&gt;
                  &lt;figcaption&gt;Contact Us!&lt;/figcaption&gt;
                  &lt;br/&gt;&lt;br/&gt;
                  &lt;/p&gt;
                  &lt;div id="openModal" class="modalDialog"&gt;
                      &lt;div&gt;
                          &lt;a href="#close" title="Close" class="close"&gt;X&lt;/a&gt;
                          &lt;p id="p1"&gt;Contact Us&lt;/p&gt;
                  &lt;form id="frm1" name="contactform" method="post" action="send_form_email.php"&gt;
                      &lt;table width="450px"&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="first_name"&gt;First Name *&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="first_name" maxlength="50" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top""&gt;
                        &lt;label for="last_name"&gt;Last Name *&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="last_name" maxlength="50" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="email"&gt;Email Address *&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="email" maxlength="80" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="telephone"&gt;Telephone Number&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;input  type="text" name="telephone" maxlength="30" size="30"&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td valign="top"&gt;
                        &lt;label for="comments"&gt;Comments*&lt;/label&gt;
                       &lt;/td&gt;
                       &lt;td valign="top"&gt;
                        &lt;textarea  name="comments" maxlength="1000" cols="60" rows="6" wrap="hard"&gt;Please provide grade level and type of assistance you are looking for.&lt;/textarea&gt;
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                       &lt;td colspan="2" style="text-align:center"&gt;
                        &lt;input type="submit" value="Submit"&gt; 
                       &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/form&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;  
          &lt;script src="js/jquery.js"&gt;&lt;/script&gt;
          &lt;script src="js/modernizr.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>HERE is my PHP file: </p>
  
  <pre><code>&lt;?php
  if(isset($_POST['email'])) {
  
      // EDIT THE 2 LINES BELOW AS REQUIRED
      $email_to = "mail@example.com";
      $email_subject = "Form Submission";
  
  
      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['first_name']) ||
          !isset($_POST['last_name']) ||
          !isset($_POST['email']) ||
          !isset($_POST['telephone']) ||
          !isset($_POST['comments'])) {
          died('We are sorry, but there appears to be a problem with the form you submitted.');       
      }
  
      $first_name = $_POST['first_name']; // required
      $last_name = $_POST['last_name']; // required
      $email_from = $_POST['email']; // required
      $telephone = $_POST['telephone']; // not required
      $comments = $_POST['comments']; // 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,$last_name)) {
      $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 .= "Last Name: ".clean_string($last_name)."\n";
      $email_message .= "Email: ".clean_string($email_from)."\n";
      $email_message .= "Telephone: ".clean_string($telephone)."\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;
   &lt;!--I WANT THIS TO STAY WITHIN THE MODAL PAGE--&gt;
  &lt;p style="font-size: 16px; text-align: center;"&gt;Thank you for contacting us. We will be in touch with you very soon.&lt;/p&gt;
  
  &lt;p style="font-size: 16px; text-align: center;"&gt;Click &lt;a href="index.html" style="text-decoration: none; color: green;"&gt;Here&lt;/a&gt; to return home.&lt;/p&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>