Generate personal word document based on form record

Hi,
I have 3 word documents (sampleA.docx, sampleB.docx, sampleC.docx) with its own content.
Example: sampleA.docx
"Hi {name},
Kindly note that your particular has been created:
DOB - {dob}
"
I created a grid that is linked to a form. My form has the following fields:

  1. name
  2. dob
  3. form_type

When user select “form_type = A”, it will retrieve the sampleA.docx and include the value for the “name” & “dob” into the word document “{name}” & {dob} respectively. The word document can then be downloaded.

I could not find any solution on the internet, can anyone kindly advise how can I upload the word document to scriptcase and retrieve the respectively document based on the records value?
​Thanks.

Not that easy. It depends on the way the document is stored. If it’s xml then you can load the complete file into your php, change content, write it and use a blank application to download it. That in general is my approach of templating. Other options to use are rtf. You need a readable format that you can manipulate from within php.

I tried creating rtf and php file without using scriptcase. I have 3 files (form.php , generate_doc.php, file.rtf).

form.php​
<form action=“generate_doc,php” method=“post”>
FirstName: <input type=“text” name=“firstname”>
LastName: <input type=“text” name=“lastname”>
<input type=“submit”>​
​</form>

​generate_doc.php
$firstname = $_POST[“firstname”];
$lastname = $_POST[“lastname”];

Basically, when my form is submitted, I can download the rtf file directly from the browser with the content filled based on the value keyed in the form. (the coding is done in generate_doc.php)

​My question is that instead of manually create a form, I am using scriptcase to create a form. How do I post all the values to the generate_doc.php upon submission of the form?

Try to debug generate app, output global variables onload and see if its ok.