Structuring script execution

From: Date: Thu, 25 Apr 2002 14:48:30 +0000
Subject: Structuring script execution
Groups: php.general 
Request: Send a blank email to php-general+get-94570@lists.php.net to get a copy of this message
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

« previous php.general (#94570) next »