[PHP] Structuring script execution

2002-04-25 Thread Donna Robinson

Hi, 

A page is loaded from two different places. 
1st call:
a href=cribsheet.html?action=* 
2nd call: 
a href=cribsheet.html?action=*download=txt 

Inside cribsheet.html: 
if ( $action == '*') { 
 if ( isset( $download ) { 
   downloadFile( $download ); 
 } 
echo 'html';
echo 'head';
 ... 
echo '/body ';
echo '/html';
} 

function downloadFile( $type ) { 
  header ... 
  $fp = fopen( $txtfile, r ); 
   fpassthru( $fp ); 
exit; 
/* need exit else the rest of the script is output as well */ 
} 

On the first call everything is fine. 
On the 2nd call (of course) the script stops execution. even sending 
header( Location: otherfile.html) won't work 'cos I get a msg saying 
headers already sent. 

I *think* my problem is working out how to structure which file contains what 
but for the life of me I can't figure it out - just go round in circles.

Donna 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Structuring script execution

2002-04-25 Thread Jason Wong

On Thursday 25 April 2002 22:48, Donna Robinson wrote:


 On the first call everything is fine.
 On the 2nd call (of course) the script stops execution. even sending
 header( Location: otherfile.html) won't work 'cos I get a msg saying
 headers already sent.

Read the manual entry for header(). Or search archives for headers already 
sent.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
I am not now, nor have I ever been, a member of the demigodic party.
-- Dennis Ritchie
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php