title: What data should be returned to Adobe Reader for PDF Form submit via PHP?
body: <p>We have a bunch of fillable PDFs that need to be submitted to various email addresses depending on their purpose and location.  Each PDF has a 'Submit' button that directs the document to a PHP script on our server that saves the completed PDF as the entire PDF document and emails the PDF as an attachment to what ever email address is specified in the URL.</p>
  
  <p>That is all working fine.</p>
  
  <p>The problem is I cannot, for the life of me, figure out or find what needs to be returned to the PDF (using Adobe Reader) for user feedback.  IE- an alert box that says 'Your form was successfully submitted' or something similar.  The script executes successfully but I keep getting an error in Reader that says, </p>
  
  <p><strong>"An error occurred during the submit process. Cannot process content of type text/html."</strong></p>
  
  <p>Here's my PHP so far.  Everything commented out at the bottom represents something I've tried already and it hasn't worked:</p>
  
  <pre><code>&lt;?php
  ob_start();
  $file = file_get_contents("php://input"); 
  $time = microtime(true);
  $newfile = "forms/" . $time . ".pdf";  
  $worked = file_put_contents($newfile, $file); 
  ob_end_clean();
  
  require 'PHPMailer/PHPMailerAutoload.php';
  
  $mail = new PHPMailer;
  $mail-&gt;isSendmail();
  $mail-&gt;setFrom('emailAddress', 'emailName');
  $mail-&gt;addReplyTo('emailAddress', 'emailName');
  $mail-&gt;addAddress($_REQUEST['email']); 
  $mail-&gt;addAttachment( $newfile );
  $mail-&gt;isHTML(true);
  $mail-&gt;Subject = 'New form submission';
  $mail-&gt;Body    = 'A new form has been submitted.';
  
  if(!$mail-&gt;send()) {
      //header('Content-Transfer-Encoding: binary');
      //return false;
      //echo "Message could not be sent:  ";
      //echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;
  } else {
      //header('Content-type: text/html');
      //echo 'Form successfully submitted';
  
      //header('Content-type: application/pdf');
      //@readfile($newfile);
  
      //echo 'Message has been sent';
  
      //header('Content-Transfer-Encoding: binary');
      //return true;
  
      //header('Content-type: text/javascript');
      //echo 'app.alert("Form emailed successfully",3);';
  
      //@readfile('success.pdf');
  
      //header('location: success.pdf');
      //header('Location: success.pdf');
      //header(location: success.html');
  }
  ?&gt;
  </code></pre>
  
  <p>Any help is greatly appreciated.  I'm sure I'm missing something simple here.<br /><br />
  <p><strong>NOTE: </strong><code>@readfile($newfile)</code> DID return the PDF back to Reader without an error message but I don't want that- I just want a simple text alert of some kind.</p>