简体   繁体   English

如何创建pdf文件并将数据从php中的用户输入保存到数据库

[英]how to create pdf file and save data to database from user input in php

i have a form that can be filled by user and having the fields, name, address, mobile number,total marks of math, science etc. when i click on submit form i should have to generate a pdf file with those user input details and save it to databse 我有一个可以由用户填写的表格,其中包含字段,名称,地址,手机号码,数学,科学等总计符号。当我单击提交表格时,我应该生成一个包含这些用户输入详细信息的pdf文件,保存到数据库

example

Personal Information
Name :**xyz**(Input filed)

E-mail :**xyz@gmail.com**(Input filed)

Address : **xyz address**(Input filed)

City :**xyz**(Input filed)


 **Results**

Maths: 50 marks(Input filed)

English: 56 marks(Input filed)

French: 65 marks(Input filed)

Cool.. Then You can use DOMPDF 酷..那么您可以使用DOMPDF

DOM PDF Example DOM PDF示例

Here is the example to generate dom. 这是生成dom的示例。 You need to include this project for php and then you can check out different examples, you'l' you solution in these examples. 您需要为php包含该项目,然后可以查看其他示例,您将在这些示例中找到解决方案。

Let me know if need some more help. 让我知道是否需要更多帮助。

DOM GITHUB 吉姆

As others have noted, saving a whole PDF to a database is not an effective use of resources. 正如其他人指出的那样,将整个PDF保存到数据库并不是对资源的有效利用。 You might considering saving the textual data into the database, and then having a separate script generate the PDF for you by querying data from the database. 您可能考虑将文本数据保存到数据库中,然后让一个单独的脚本通过查询数据库中的数据来为您生成PDF。 I have had good luck with TCPDF for this purpose. 为此,我对TCPDF感到很幸运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM