page reloading
| From: | Donna Robinson | Date: | Thu, 02 May 2002 13:54:39 +0000 |
| Subject: | page reloading | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95693@lists.php.net to get a copy of this message | ||
Hi,
This is driving me nuts - all help appreciated!
The problem is that I can never get the html stuff output *after* having
included "download.inc" because of the "exit;" call -- which I have to have
else the html gets output and downloaded as well (and I don't understand why
fpassthru doesn't stop at EOF on $fp).
Is there any way to do this without the user having to click on yet another
link/button somewhere?
Donna
User clicks on a link in pageA.html:
<a href="./cribs.html?action=downloadtxt"><u>Download TXT</u></a>
cribs.html:
<?php
if ( $action == 'downloadtxt' ) {
include( '../include/downloadtxt.inc' );
$action = 'howto';
}
if ( $action == 'howto' ) {
?>
<html>
... more html stuff here
</html>
<?php
}
?>
downloadtxt.inc:
<?php
create a txt file, and then:
header( "Content-Transfer-Encoding: base64" );
... more header stuff
$fp = fopen( "$txtfile", "r" );
fpassthru( $fp );
exit;
?>