How can I transfer data collected from a HTML form to a word document using Php?

Hi,

When the user fills out my form and clicks on the button “Generate CV” how can I then convert that code to a word document and automatically force a download to the user’s download folder?

Below is my current code. I don’t have any PHP yet as I’m just seeing if it’s even possible.

<!-- Form-->
         <section class="module bg-gray text-center divider-bottom p-3">
            <div class="container">
               <div class="row">
                  <div class="col-md-12">
                     <form id="contact-form" method="post" novalidate>
                        <div class="row">
                           <div class="col-md-4">
                              <div class="form-group">
                                 <input class="form-control" type="text" name="name" placeholder="Name (Click Me)" required="">
                                 <p class="help-block text-danger"></p>
                              </div>
                           </div>
                           <div class="col-md-4">
                              <div class="form-group">
                                 <input class="form-control" type="email" name="email" placeholder="E-mail (Click Me)" required="">
                                 <p class="help-block text-danger"></p>
                              </div>
                           </div>
                           <div class="col-md-4">
                              <div class="form-group">
                                 <input class="form-control" type="text" name="subject" placeholder="Mobile Number (Click Me)" required="">
                                 <p class="help-block text-danger"></p>
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <textarea class="form-control" name="message" placeholder="Education History (Click Me)" rows="12" required=""></textarea>
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <textarea class="form-control" name="message" placeholder="Previous Employers (Click Me)" rows="12" required=""></textarea>
                              </div>
                           </div>
                           <div class="col-md-12">
                              <div class="form-group">
                                 <textarea class="form-control" name="message" placeholder="Personal Skills / Hobbies (Click Me)" rows="12" required=""></textarea>
                              </div>
                           </div>
                           <div class="col-md-12">
                              <p></p>
                              <div class="text-center">
                                 <input class="btn btn-circle btn-outline-brand" type="submit" value="Generate CV">
                              </div>
                           </div>
                        </div>
                     </form>
                     <!-- Ajax response-->
                     <div class="ajax-response text-center" id="contact-response"></div>
                  </div>
               </div>
            </div>
         </section>
         <!-- Form end-->

You could use a library like docx.js to generate a Word document from the user’s form data. Once you have the document generated, you can then use the HTML5 download attribute to force the download of the document to the user’s download folder.

Sponsor our Newsletter | Privacy Policy | Terms of Service