Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allowing a user to save a web page on the server

Status
Not open for further replies.

marcusmj

MIS
Feb 6, 2003
4
US
I am building a reporting application. The reports are dynamically created using PHP. I want to allow a user to view a report, and optionally save it on the web server. I would then store the name and location of the report file in a relational database, tied to the user's ID.

I'm not sure how to go about saving the web page on the server. The "save" button could run javascript that grabs document.body.innerHTML and posts the result to a server page, which could then use PHP to write the content to a file, but that doesn't seem like a great approach... among other things, all the <head> content would be lost.

Theoretically, I could save a copy of each report as it is created on the server, and then later on delete the ones that aren't saved by the user. I don't know how I would implement this in PHP though; the PHP content is only a subset of the actual report.

Many thanks for any advice on this.
mike
 
Why not save the options that users are inputting to create the report...give them the option to save it as a name an store those settings as an array(or even store the sql statement that generated the report)


Bastien

Cat, the other other white meat
 
Hi,

Unfortunately that is not an option for me. The data that underlies the report changes frequently. The objective of saving the report is to capture a point-in-time "snapshot" of the data, based on the user's criteria at the time they chose to run the report.

Thanks again,
mike
 
then use fopen and fwrite to create an html page on the fly. Save this to the filesytem with whatever name works for you and then redirect the user to this report...




Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top