Thanks Brian for the tip. I should be using that instead.

On Sep 8, 12:26 pm, brian <[email protected]> wrote:
> Why don't you use Cake'ssessionmessaging?
>
> controller:
> $this->Session->setFlash('...');
> $this->redirect(array(...));
>
> view:
>
> <?php if ($session->check('Message.flash')) $session->flash(); ?>
>
> On Tue, Sep 8, 2009 at 2:28 AM, Spence<[email protected]> wrote:
>
> > Hi fellow developers,
>
> > I am encountering a hard-to-debugsessionproblem where asession
> > variable is sometimesnotbeingset. The following is the correct
> > scenario:
>
> > 1) Users clicks submit on a form page and the following controller
> > code is executed:
> > 2)   $_SESSION['sess_var_msg'] = "You have successfully registered.";
> >      $this->redirect("/businessprofile/");
> >      exit;
> > 3) Thesessionvariable is displayed on the redirected page.
> >      <? if ($_SESSION['sess_var_msg'] != "") { ?>
> >                ... <?=$_SESSION['sess_var_msg']?> ...
> >         <?     $_SESSION['sess_var_msg'] = "";
> >          } ?>
>
> > The problem is that thesessionvariable isnotalwayssetor
> > displayed, but after I execute the code again, it works fine and every
> > time continuously afterward. The problem seems to occur after the
> >sessionhas been idle for a long time. However, the entiresession
> > itself is never lost or expired because all pages require the user to
> > be logged in and I always see the user's name (anothersession
> > variable) on each page.
>
> > It seems like it can be a cache problem, but I am setting nocache in
> > the beforeRender() function of my app_controller.php as follows:
> >    header("Cache-Control: no-store, no-cache, must-revalidate, post-
> > check=0, pre-check=0"); // // HTTP/1.1
> >    header("Pragma: no-cache");
> >    header("Expires: Mon, 17 Dec 2007 00:00:00 GMT");
>
> > -- ADDITIONAL INFO --
> > Cake Version: 1.2.0.6311
> > Core.php ::Session.save: PHP
> > PHP Version: 5
> > Browser: Firefox 1.3 (and using multiple tabs)
>
> > Does anyone have any ideas?
>
> > Thanks,
> > Spence
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to