Jump to content

content to HTML *Help please*


hpvc

Recommended Posts

When the link to save the page is clicked, make the following code execute:-

 

header('Content-Type: text/html');
header('Content-Disposition: attachment; filename=file.txt');
echo "Hello"; // Output the page contents you want the user to download here

 

Note: header() will not work if you have already output html content in the page. So in your case, probably is is best to write the above code in a separate file and link to that file. Even if the code is in a separate file, the user will not be taken to that new file, instead he will stay in the current page and a download prompt will be shown  :D

When the link to save the page is clicked, make the following code execute:-

 

header('Content-Type: text/html');
header('Content-Disposition: attachment; filename=file.txt');
echo "Hello"; // Output the page contents you want the user to download here

 

Note: header() will not work if you have already output html content in the page. So in your case, probably is is best to write the above code in a separate file and link to that file. Even if the code is in a separate file, the user will not be taken to that new file, instead he will stay in the current page and a download prompt will be shown  :D

 

I forgot about using headers, this is a great solution! 0.0

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.