|
Posted by Mike Willbanks on 10/12/05 03:15
Jason,
> I have created a wizard which walks a user through a process of
> selecting data to be generated into an XML file.
>
> Each page adds its own data to $_SESSION, until the final page. On this
> page, an input button launches a PHP script (genHTML.php) that creates
> an HTML file. The genHTML file starts by setting two headers:
>
> header('Content-type: text/html');
> header('Content-Disposition: attachment; filename="countymap.html"');
>
> The first time I create the HTML file (which is actually a Smarty
> template), the variable $_SESSION['key'] is added to the countymap.html
> template and the user is prompted to save the countymap.html file.
>
> However, if I click the button to generate the file more than once,
> $_SESSION['key'] is somehow unset.
>
> Each page of the wizard calls session_write_close() at the end of the
> script, which I thought would solve the problem, but did not.
Do all pages have session_start at the top of them, including the page
where you are generating the file?
Are you closing the session or setting the session to an array on the
page which generates the file?
What makes me as this is you said the genHTML file starts by setting two
headers, you MUST have the session_start at the beginning!
--
Mike Willbanks
Zend Certified Engineer
http://www.digitalstruct.com
[Back to original message]
|