title: How to show the success message of PHP in html page on Form submission
body: <p>I am developing website in html. In Careers.html page i am having Apply button. On clicking that apply button it will send the mail using php file. On suceess event i need to set the alert or to show the div on the same Careers.html page. </p>
  
  <p>Careers.html</p>
  
  <pre><code>&lt;form method="post" action="Applyresume.php" enctype="multipart/form-data"&gt; 
       &lt;tr&gt;
       &lt;td&gt;First Name  &lt;/td&gt;
       &lt;td&gt;&lt;input type="TextBox" name="First_Name" class="applytext" required&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
       &lt;td&gt;Last Name &lt;/td&gt;
       &lt;td&gt;&lt;input type="TextBox" name="Last_Name" class="applytext" required&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
       &lt;td&gt;E-mail  &lt;/td&gt;
       &lt;td&gt;&lt;input type="TextBox" name="email" class="applytext" required&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
       &lt;td&gt;Phone  &lt;/td&gt;
       &lt;td&gt;&lt;input type="TextBox" name="Phone_No" class="applytext" required&gt;&lt;/td&gt;
       &lt;/tr&gt;
        &lt;tr&gt;
      &lt;td&gt;Attachment  &lt;/td&gt;
      &lt;td&gt;&lt;input type="file" name="attachment" maxlength="50" allow="text/*" class="applytext" required&gt;&lt;/td&gt;
      &lt;/tr&gt;
       &lt;tr&gt;
       &lt;td colspan="2"&gt;&lt;input type="submit" name="button" class="send-resume" value="SEND" style="margin-left:24%;"&gt;
      &lt;input type="reset" value="RESET" style="margin-left:8%"&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;/form&gt;
  </code></pre>
  
  <p>Applyresume.php</p>
  
  <pre><code> &lt;?php 
      if($_POST &amp;&amp; isset($_FILES['attachment']))
      {  
          $name= $_POST['First_Name'];
          $lname= $_POST['Last_Name'];
          $email= $_POST['email'];
          $phonenum = $_POST['Phone_No'];
          $from_email = $_POST['email']; //sender email
          $recipient_email = 'nisha@acute.company'; //recipient email
          $subject = 'Test Email '; //subject of email
          $message = 'Resume attached below.'; //message body
              $emailbod = "$name
          $lname
           $email
           $phonenum";
          //get file details we need
          $file_tmp_name    = $_FILES['attachment']['tmp_name'];
          $file_name        = $_FILES['attachment']['name'];
          $file_size        = $_FILES['attachment']['size'];
          $file_type        = $_FILES['attachment']['type'];
          $file_error       = $_FILES['attachment']['error'];
  
          $user_email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
  
          if($file_error&gt;0)
          {
              die('upload error');
          }
          //read from the uploaded file &amp; base64_encode content for the mail
          $handle = fopen($file_tmp_name, "r");
          $content = fread($handle, $file_size);
          fclose($handle);
          $encoded_content = chunk_split(base64_encode($content));
  
  
              $boundary = md5("sanwebe"); 
              //header
              $headers = "MIME-Version: 1.0\r\n"; 
              $headers .= "From:".$from_email."\r\n"; 
              $headers .= "Reply-To: ".$user_email."" . "\r\n";
              $headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n"; 
  
              //plain text 
              $body = "--$boundary\r\n";
              $body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
              $body .= "Content-Transfer-Encoding: base64\r\n\r\n"; 
              $body .= chunk_split(base64_encode($emailbod)); 
  
              //attachment
              $body .= "--$boundary\r\n";
              $body .="Content-Type: $file_type; name=\"$file_name\"\r\n";
              $body .="Content-Disposition: attachment; filename=\"$file_name\"\r\n";
              $body .="Content-Transfer-Encoding: base64\r\n";
              $body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n"; 
              $body .= $encoded_content; 
  
  
  
          $sentMail = @mail($recipient_email, $subject,  $body, $headers);
          if($sentMail) //output success or failure messages
          { 
                   echo '&lt;script type="text/javascript"&gt;alert("Thanks for your interest. Your Resume has been sent to HR@prominData.com");window.location.assign("Careers.html");&lt;/script&gt;';
          }else
         {
               echo"&lt;script&gt;alert('Could not send mail! Please check your PHP mail configuration.')&lt;/script&gt;";
          }
  
      }
      ?&gt;
  </code></pre>
  
  <p>My problem is I need to set the success alert in the same html page.
  But here my success alert is opening in PHP page.</p>
  
  <p>How to add this php code in same html page?</p>