[PHP] page reloading
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=downloadtxtuDownload 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; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] page reloading
Hi, 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). [...] downloadtxt.inc: ?php create a txt file, and then: header( Content-Transfer-Encoding: base64 ); ... more header stuff $fp = fopen( $txtfile, r ); fpassthru( $fp ); exit; ? Replace exit; with fclose( $fp );. Please note that headers must be sent before any other output. What you are trying to achieve can be done with refresh headers (either html-meta or http). -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software Systems Engineer First Creative Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] page reloading
On Thursday 02 May 2002 3:08 pm, Dan Hardiker wrote: Replace exit; with fclose( $fp );. Nope - tried this way back when - if you rtfm you will see that the file is closed when fpassthru() is done reading it. If you use fclose what you get is this: PHP Warning: 27 is not a valid File-Handle resource in ... Please note that headers must be sent before any other output. yah i know this - it's the major source of my problem! What you are trying to achieve can be done with refresh headers (either html-meta or http). Huh? pls explain. Donna -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] page reloading
On Thursday 02 May 2002 4:26 pm, Donna Robinson wrote: What you are trying to achieve can be done with refresh headers (either html-meta or http). Huh? pls explain. Forget it - I figured it out. If I send this along with the rest of the headers everything is just peachy: $url = $PHP_SELF.'?uid='.$uid.'pwd='.$pwd.'action=howto'; header( 'Refresh:0; url='.$url.''); ... But thanks for the pointer! Donna -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php