473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

header problem - want to display html AND download a file

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.
Jul 17 '05 #1
2 2302
mike wrote:
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...."
What about?
4) A page displays saying something like

Your document has been generated. You may <a
href="customssdisplay.php">download it</a> by right-clicking
and choosing "Save as ...".
5)Excel File is sent to user's PC.

--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
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" <mi**@dogstar1.com> napisal w wiadomosci
news:80**************************@posting.google.c om...
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.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thomas Kemmerich | last post by:
hi, i'm looking for a possibility to start a download. here is my current code: header("Content-Type: $_contenttype"); header("Content-Disposition: attachment; filename=\"$_filename\"");...
10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
30
by: Anon | last post by:
If Http headers specify the character encoding, what is the point of the Meta tag specifying it?
11
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do...
2
by: Whitney | last post by:
I've been going bonkers trying to find the answer to this question... I'm hoping somebody out there can help me. Our network environment is Active Directory and our web server is Windows 2003 IIS...
11
by: Peter Wu | last post by:
Hello, I want to create a Header and Footer for every ASPX page I build. I created 2 Web user controls respectively and placed them in an ASPX page. The problem is that I cannot position the...
10
by: universalbitmapper | last post by:
Hi, I'm trying a simple form.html that call a .html script that begins with: <?php header("This is a test"); ?> When I click on the link, I get blank page.
1
by: AndrewF | last post by:
Hi all, I am sure something like this has been covered somewhere so I am hoping a quick answer or pointer may suffice, however a couple of days trawling and I can't find anything on it. I'm...
6
ak1dnar
by: ak1dnar | last post by:
Hi, I am creating script to download some files using download dialog box.First time i tried to use ajax for this, but i failed. So i went through this way, By Using this function i am going to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.