PDF form submission

2019-06-08 18:54发布

I have a PDF form (made in Acrobat) that has button to submit via HTTP. What I want to do it have a PHP script that will take the PDF form and e-mail it to me via attachment.

What I don't want:

--PDF Submit via e-mail button. This requires webmail users to save the pdf and attach it, and is just too confusing for most users. I want one-click and done.

--Submit via mailto:email@address.com. Does the same thing as above.

If there's a pdf on the server, I know how to use PHP's mail() function to e-mail it to someone. What I don't know how to do is process the PDF once someone hits Submit within the PDF.

Does that make sense?

Thanks, Jeff

1条回答
劫难
2楼-- · 2019-06-08 19:34

I think I fixed it. Found the answer on another forum, but had to remember to set write permissions on my server.

<?php

$fileatt = date("d-m-Y-His") . ".pdf";  // Creates unique PDF name
copy('php://input',$fileatt); // Copies POST data to pdf file

?>

Make sure the PDF button is set to send data as "PDF" not "HTTP Post data"

The form will sent a blank PDF back to the user... But you can send whatever response you want by doing

header('Location: your_return_form.pdf');

(or re-direct to another webpage, or whatever)

Still has some kinks, but works for the most part I think.

查看更多
登录 后发表回答