开发者

PDF form submission

开发者 https://www.devze.com 2022-12-24 16:20 出处:网络
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.

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 a开发者_运维问答s 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消