Re: header problem - want to display html AND download a file
From: Chung Leong (chernyshevsky_at_hotmail.com)
Date: 02/11/04
- Next message: Geoff Berrow: "Re: converting linebreaks to br"
- Previous message: Chung Leong: "Re: Which is better OOP, and why?"
- In reply to: mike: "header problem - want to display html AND download a file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 10 Feb 2004 19:05:16 -0500
It's a bird. It's a plane. No, it's the invisible inline frame!
There's some test code:
test.php:
<html>
<body>
<p>The download will start now!</p>
<iframe src="test2.php?query=<?=$query?>" style="display: none"></iframe>
<p>Something something...</p>
</body>
</html>
test2.php:
<?
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=\"testing.txt\"");
echo str_repeat("Hello world\n", 1000);
?>
Uzytkownik "mike" <mike@dogstar1.com> napisal w wiadomosci
news:808dc180.0402101030.2a3b7395@posting.google.com...
> ok here's the problem:
>
> I have a page that displays a form for user to select individual
> fields and to specify their own criteria which is used to query a
> database and then create an excel spreadsheet and download it to their
> PC.
>
> when the user clicks on the "create a custom query" link on the
> reports page the file customss.php displays the form that list the
> various fields and criteria to specify for the search. This part
> works fine.
>
> once the user clicks the button to submit the query the file
> customssdisplay.php generates the Excel file and then sends it to the
> client PC.
>
> The problem is that once the user cliks the button to submit the
> query, the form which displays the list of available criteria and
> fields is still displayed EVEN AFTER the spreadsheet has been
> downloaded to the PC.
>
>
> Here's what I would like to happen is:
>
> 1)user clicks button to create the custom query
>
> 2)the form is displayed for the user to check fields for inclusion and
> specify search criteria.
>
> 3)user chooses what they want and then clicks "submit query"
>
> 4)******* A page displays saying something like "Generating
> report...."
>
> 5)Excel File is sent to user's PC.
>
>
>
> OK now I've tried specifying a bit of html in the customssdisplay.php
> file that generates the spreadsheet but this gives me error messages
> saying that the header has already been sent. I suppose I could
> create a passthrough file which creates a form with all the fields
> hidden (taken from the search criteria page) but this seems cumbersome
> and inefficient. I would appreciate any help that could be offered.
- Next message: Geoff Berrow: "Re: converting linebreaks to br"
- Previous message: Chung Leong: "Re: Which is better OOP, and why?"
- In reply to: mike: "header problem - want to display html AND download a file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|