Hi.
I'm rather confused with forcing a download. I just want to save dynamic content (from $_SESSION[''] data) as a .html file.
The script to do this is a PHP page, but when I click on "download" it downloads as "download.php"
Here's the code:
Code: header("Cache-control: private"); //IE 6 Fix
if (isset($_GET['download']) && $_GET['download']=="true" && isset($_GET['filename']) && $_GET['filename']!="") {
// retrieve content of the file here, e.g. from a database...
$content=$_SESSION['old_page'];
// send the header here
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="' . $_GET['filename']);
// put the content in the file
echo($content);
// stop processing the page
exit;
}
It's accessed using: Code: <a href="../outputs/download_as_file.html?download=true&filename=shine_output.html">Download</a>
Any suggestions? I found a good tutorial here: http://richardlynch.blogspot.com/2006/06/php-downloads-content-disposition.html but don't think it'll do what I need to do
Protecting forms
Alright, I want to protect some forms of mine from SQL Injections, because I had someone earlier spamming, and not just regular spamming. They edited all the current user posts to their name, and
Beginner PHP code help
Hi I'm new to php but if someone could please read the question below and help it would be great.a)create an html page to enter a row number (1-6) in a textbox to choose a list of student records.b)
user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to be working.After logging in with username, password, and a special code, the user is transferred to
contact form - output to page and email
I have the following in my controller:$message['name'] = htmlentities(strip_tags(trim($_POST['name']))); $message['email'] = htmlentities(strip_tags(trim($_POST['email'])));$to =
Count on multidimensional array
Hi, i got an array as below:Array( => Array ( [2009-12-08] => 1 ) [1] => Array ( [2009-12-07] => 1 ) [2]
subtract 1 from value entered in text field
HiHow do I subtract 1 from the vaue entered into a text field?Thanks
Google voice
I currently have a form in html, but I want it in php so the information is not in the source code.It all works and when you put in the name and number it will call. When you push the call button it
Help: problem with Headers to download PDF file
Hi,I'm trying to implement a script where when a user clicks a link he gets a PDF file to open or save.In my index.php page I have the following link:Code: <a
Curly Bracket Delimeters.
I'd always believed that the starting and ending delimeters in preg_ functions had to be the same character, but recently discovered that you can use the curly brackets.Example:Code:
Schedule editor
Hi,