Re: Sessions

From: Date: Mon, 05 Aug 2002 23:17:21 +0000
Subject: Re: Sessions
Groups: php.general 
Request: Send a blank email to php-general+get-111286@lists.php.net to get a copy of this message
>Hi Guys! > >I am having trouble with my sessions. Basically I have a php script from >which I register a session variable: > >session_register("myVar"); >$myVar = "hello"; > >My problem arises when I try to output the variables further down the page >using $HTTP_SESSION_VARS['myVar'] it just doesn't display anything unless I >refresh the page then it works ok. > >I have tried using the ob_start() and ob_end_flush() functions to buffer the >output, these seem to work great with cookies but not so great with session >variables. > >Does anybody have any ideas how I should be tackling this? In slow-motion: Your browser surfs to the URL. You register variables. (They are *NOT* put into the _SESSION var yet...) Your script ends. The variables are stored. You surf again. You start the session. The variables are loaded *into* _SESSION at this point. You may find it easier in recent versions of PHP to use the documented technique of: start_session(); $_SESSION['myVar'] = 'hello'; Then the variables will be there because you put them there. :-) -- Like Music? http://l-i-e.com/artists.htm I'm looking for a PRO QUALITY two-input sound card supported by Linux (any major distro). Need to record live events (mixed already) to stereo CD-quality. Soundcard Recommendations? Software to handle the recording? Don't need fancy mixer stuff. Zero (0) post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo audio-to-disk.

« previous php.general (#111286) next »