On Feb 8, 2008 10:14 AM, Hiep Nguyen <hiep@xxxxxxxxxx> wrote: > > On Fri, 8 Feb 2008, Per Jessen wrote: > > > Hiep Nguyen wrote: > > > >> is there anyway to generate this into xls file w/o using fopen & > >> fwrite to the server? my goal is to have a link after the table and > >> user can click on that link and a save window pop up to allow user to > >> save to local disk. > > > > Yes - have a link like this: > > > > <a href="<yourscript.php?parameters>">Get XLS file</a> > > > > in yourscript.php, you evaluate the parameters given and build the XSL > > file as output: > > > > header("Content-Type: application/excel"); > > header("Content-Disposition: attachment; filename=\"filename\""); > > > > print > > . > > . > > . > > . > > . > > > > > > done. > > i already got this method, but the problem that i have is the parameters > is mysql statement and it's very long. i don't think a good idea to pass > this in the url. also, the page that i'm working on is a search page, > therefore the mysql statement is very complicate and long. that's why i > don't want to pass via url. > > is there way to do within this page??? > > t. hiep > > How are you passing the parameters to THIS page? The solution Per presented would either require the same parameter list as the current page (if going to a URL dedicated to sending the output in the format you are using for the xls) or one additional parameter to the current page if you the current page is written to vary the style of the output based on that parameter's value. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php