Okay, this has gone over my head. I am running Apache 1.3.19, with PHP 4.0.5
and mySQL 3.23.37. The Apache/PHP server is on a Windows development box,
and the mySQL is on a remote box. The basic function of the script is to
first present a form where a user can select records that match a date, and
then they can choose whether to have the records be displayed on-screen, or
be sent as a file.

Now, on-screen works beautifully. But, if I try the following code and
specify to send as a file:

if($ExportTo == "display")
  {
   print $FinalContent;
  }
elseif($ExportTo == "file")
  {
   $FileName = "export-$RecordDay-$RecordMonth-$RecordYear.csv";
   Header("Content-Type: application/x-octet-stream");
   Header("Content-Disposition: attachment; filename=$FileName");
   print $FinalContent;
   exit;
  }

- I get the popup window asking if I want to save it or open it. But the
filename is not export-date.csv like it should be. Furthermore, if I choose
to save the file and then open it in a text editor, what I see is not
$FinalContents, which is the expected output, but instead I see the form
that I just submitted FROM. Yes, it saves the exact page I'm looking at -
the one with the submit button I just pushed.

Now, I know that it is getting to those Header() tags because they are the
only ones in the code. So it is going inside the elseif() block. It is
confusing the heck out of me.

- Jonathan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to