Create A HTML File

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Create A HTML File

Post by icesolid »

I want to have PHP create a HTML file temporarily for the user to view and once the user closes the page it is deleted.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Why not just output the HTML
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Download Option

Post by icesolid »

Because I want to provide the user with an option to download the output they are looking at.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can regenerate the file for them to download...
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Dynamic Files

Post by icesolid »

The output on this file is going to be dynamic it is going to change depending on their ticket information.

I dont want to have 100,00 HTML files on the server, I just want a temporary HTML file that fills in their ticket information for them to download.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you never have to save the html to a file. You regenerate the html on the fly and tell the browser to download it. It's really quite simple.

Look through the header() function, which has some examples of making downloads.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

Or you can mail it to them.
MinDFreeZ
Forum Commoner
Posts: 58
Joined: Tue Feb 14, 2006 12:28 pm
Location: Lake Mary, FL

Post by MinDFreeZ »

yea... basically it's all been said.. u never need to actually save the html file.... let PHP generate it.. u can change this "ticket" thing all day and it will still output fine... u can always add a little javascript print button - not sure how u plan on having them download it..
Post Reply