Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:14:53+00:00 2026-06-15T11:14:53+00:00

In my application, the user can create a receipt according to the rent items.

  • 0

In my application, the user can create a receipt according to the rent items.

I use this code to create a Word file (.doc) out of an exisiting template.

        header("Content-type: application/vnd.ms-word");
        header("Content-Disposition: attachment;Filename=Rent_Receipt_". $_SESSION['custid']    .".doc");
        include ("templates/template_receipt.php");

Now the user will have this stored on his local computer, but how can I make the server to store this same document in the server folder, so the user don’t have to upload it manually?

Thanks in advance.

EDIT
The include: template_receipt.php contains HTML code for the Word document to be created:

<?php echo "
<html xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:w='urn:schemas-microsoft-com:office:word'
xmlns:m='http://schemas.microsoft.com/office/2004/12/omml'
xmlns='http://www.w3.org/TR/REC-html40'>

<head>
<meta http-equiv=Content-Type content='text/html; charset=windows-1252'>
<meta name=ProgId content=Word.Document>
<meta name=Generator content='Microsoft Word 14'>
<meta name=Originator content='Microsoft Word 14'>
<link rel=File-List href='Template%20Verhuurbon_files/filelist.xml'>
<link rel=Edit-Time-Data href='Template%20Verhuurbon_files/editdata.mso'>
<link rel=dataStoreItem href='Template%20Verhuurbon_files/item0001.xml'
target='Template%20Verhuurbon_files/props002.xml'>
<link rel=themeData href='Template%20Verhuurbon_files/themedata.thmx'>
<link rel=colorSchemeMapping
href='Template%20Verhuurbon_files/colorschememapping.xml'>

And so on. I’m going to look into this ob*_ in a second. Thank you for fast response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:14:55+00:00Added an answer on June 15, 2026 at 11:14 am

    ob_* functions will help.
    For example:

    <?php
        // geting file content
        ob_start();
        include ("templates/template_receipt.php");
        $content = ob_get_contents();
        ob_end_clean();
    
        //store in local file
        file_put_contents('/file/name.txt',$content);
    
        // file output:
        header("Content-type: application/vnd.ms-word");
        header("Content-Disposition: attachment;Filename=Rent_Receipt_". $_SESSION['custid']    .".doc");
        echo $content;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java application were the user can create a text file and
Application: This is a workshop proposal system for a conference. A user can create
My application will contain a custom calendar, and according to this calendar user can
In my application user can create post,however only the creator of the post can
I am writing an application , which User can create Topics and others can
I am trying to create an iPhone application where the user can add entries.
I'm looking for a user interface language to create an application that can be
In my application the user can create multiple objects (so called drawings) each of
In my application a user can create his/her photo album. My question is how
I have a web application where user can create his/her account.I want that user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.