You are here: Re: Disappearing $_SESSION « PHP Programming Language « IT news, forums, messages
Re: Disappearing $_SESSION

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация