|
Posted by comp.lang.php on 02/27/06 16:58
Norman Peelman wrote:
> "comp.lang.php" <phillip.s.powell@gmail.com> wrote in message
> news:1140923087.282743.321640@v46g2000cwv.googlegroups.com...
> > This is an urgent request (as always)
> >
> > [code]
> >
> > generate_admin_customer_position_dropdown($customerResult,
> > $customerResult[0]->id);
> > print_r($_SESSION["${projectAcronym}_customerSOWObjectArray"]);
> > [/code]
> >
> > This code will generate an HTML dropdown as well as set a $_SESSION
> > variable.
> >
> > I can verify the function works perfectly and in fact sets the session
> > variable every time. Problem is that I need to set and then
> > IMMEDIATELY get the session variable w/o redirection because
> > redirection is undoable at the portion of the PHP code that this must
> > work in.
> >
> > What do I do? Each time I try this the session variable is NOT
> > immediately available until a latter iteration renders it available but
> > far too late to be used.
> >
> > How do I set and then IMMEDIATELY get a SESSION variable? This is an
> > urgent request!!
> >
> > Thanx
> > Phil
> >
>
> Not exactly sure what you mean... How can you verify that the $_SESSION
> variable is set if you also state you can't access it.
>
> place this before your print_r statement: echo "<!-- SESSION
> status:\n\r".var_dump($_SESSION)."\n\r-->";
>
> then look in the source code of the resulting page. This will show you all
> the $_SESSION variables and their values.
>
> I can set a session and immediatley access it all day long... it has to be
> something else. To me it appears that this could be the culprit:
>
> print_r($_SESSION["${projectAcronym}_customerSOWObjectArray"]);
>
> ...what is "${projectAcronym}_customerSOWObjectArray"? In otherwords what
> is 'projectAcronym'? It can do it this way too, no problem. If
> 'projectAcronym' is a variable (it really has a $ in front of it) then you
> need to make sure it is set properly. The $ can go inside the curly braces
> as well and should keep things easier to read. Just try entering the little
> code snippet above and you'll see what the session variables are.
>
Thanks, however, over the weekend I was able to brute-force it to work
by rewriting the entire function. To not dump out a 100-line function
to solve you all the heartache of dealing with mounds of raw code,
basically, it works now, sets and gets $_SESSION variable as it should,
so thanx!
Phil
> Norm
Navigation:
[Reply to this message]
|