PHP Classes

file export woe's

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  file export woe's  
Subject:file export woe's
Summary:Can't seem to properly setup an xls export...
Author:Chris Wilson
Date:2009-03-03 22:53:08
Update:2009-03-11 17:06:03

  1. file export woe's   Reply   Report abuse  
Chris Wilson - 2009-03-03 22:59:08

I'm hoping someone can help me here.

My problem is this:
I've performed a very simple SQL query, and structured it in a table. at the end of the table I have the option to export the table to excel.

the code for the link is <a href="display.php?export=excel">export to excel</a>

within this page the first line of code is:

$sExport = @$HTTP_GET_VARS["export"];

if ($sExport == "excel") {
header('Content-Type: application/');
header('Content-Disposition: attachment; filename=Load.xls');

This works FINE - but I have another variable that I pass using GET to determine how to query the database, and populate the table. this code is directly below:

if($_GET['export'] == "nsls"){

//query database based on NSLS sources

} else if($_GET['export'] == "ms1") {

//query database based on ms1 sources

} else if($_GET['export'] == "ms2") {

//query database based on ms2 sources


the called function is what determines the contents of the table...

without this code, the export works fine, opening in excel the appropriate data table. as soon as I add this code, my excel document is just a copy of the web page this is on...

What am I missing??

Please let me know if you have any suggestions, or let me know if you need more input.

Thanks very much in advance!

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.

Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.