Use PHP to replace fields in word template with form data
Moderator: General Moderators
Use PHP to replace fields in word template with form data
Hi All
I would appreciate some advice on where to start with this daunting task i have. Please also bear with me as i am fairly new to PHP.
I’ve created an online form for my clients to complete in order to get a quote. The only thing I can get this form to do so far is to email the captured data to an email address.
What I would like to achieve is the following:
1: Save the data captured by the client onto my database
2: then get php to recall that data and replace it with fields in a word .docx template I’ve created
3: Finally php must convert the created docx into a PDF doc which the client immediately get once they’ve clicked on the form’s “Get quote” button.
I would appreciate some advice on where to start with this daunting task i have. Please also bear with me as i am fairly new to PHP.
I’ve created an online form for my clients to complete in order to get a quote. The only thing I can get this form to do so far is to email the captured data to an email address.
What I would like to achieve is the following:
1: Save the data captured by the client onto my database
2: then get php to recall that data and replace it with fields in a word .docx template I’ve created
3: Finally php must convert the created docx into a PDF doc which the client immediately get once they’ve clicked on the form’s “Get quote” button.
Re: Use PHP to replace fields in word template with form dat
Re: Use PHP to replace fields in word template with form dat
Thank you so much for you quick reply.
Its just easier for me to create templates in word.
Is there any tutorials on the net that can help with this?
Its just easier for me to create templates in word.
Is there any tutorials on the net that can help with this?
Re: Use PHP to replace fields in word template with form dat
Help with what, specifically? The PDO book on the PHP site is full of examples and the FPDF site has a tutorials section.ldupreez wrote:Is there any tutorials on the net that can help with this?
-
x_mutatis_mutandis_x
- Forum Contributor
- Posts: 160
- Joined: Tue Apr 17, 2012 12:57 pm
Re: Use PHP to replace fields in word template with form dat
You can convert HTML to PDF easily using HTML2PDF. That would eliminate your need to maintain a Word doc. template as well.
Re: Use PHP to replace fields in word template with form dat
The word doc template is a quotation which include terms and conditions the client has to sign for and also contain a list of information required from them. From the data they have entered the php must determine how much the quote will be and replace those fields in the template. will i be able to do this with a pdf file?
-
x_mutatis_mutandis_x
- Forum Contributor
- Posts: 160
- Joined: Tue Apr 17, 2012 12:57 pm
Re: Use PHP to replace fields in word template with form dat
Convert the word doc into a HTML form (using CSS where necessary) and show it to the user as a web page on a browser. When a user submits the form, you can then process and show them a HTML page (that contains fields replaced with the quotes that you determine), and give them an option to download it as PDF.ldupreez wrote:The word doc template is a quotation which include terms and conditions the client has to sign for and also contain a list of information required from them. From the data they have entered the php must determine how much the quote will be and replace those fields in the template. will i be able to do this with a pdf file?
As far as a signature is concerned, you can have them type their full name authorizing the document. If their hand written signature is required, well then you are left with no choice but to use a word document. In-fact the user needs to scan the hard-copy he/she signed.
Re: Use PHP to replace fields in word template with form dat
Their hand written signature is required, so what do i do then?x_mutatis_mutandis_x wrote:Convert the word doc into a HTML form (using CSS where necessary) and show it to the user as a web page on a browser. When a user submits the form, you can then process and show them a HTML page (that contains fields replaced with the quotes that you determine), and give them an option to download it as PDF.ldupreez wrote:The word doc template is a quotation which include terms and conditions the client has to sign for and also contain a list of information required from them. From the data they have entered the php must determine how much the quote will be and replace those fields in the template. will i be able to do this with a pdf file?
As far as a signature is concerned, you can have them type their full name authorizing the document. If their hand written signature is required, well then you are left with no choice but to use a word document. In-fact the user needs to scan the hard-copy he/she signed.
-
x_mutatis_mutandis_x
- Forum Contributor
- Posts: 160
- Joined: Tue Apr 17, 2012 12:57 pm
Re: Use PHP to replace fields in word template with form dat
Provide an ablilty to download the form (in PDF/Word), after it's filled, and after you process it. Then give them an ability to upload the form. But you need to validate if they are uploading the right form, and if it's been signed (which is quite hard to achieve). The best solution is to have them type in their full name.