"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> --- Five <[EMAIL PROTECTED]> wrote:
> > page1.php
> > <?php
> > session_start();
> > echo 'page #1<br>';
> >
> > echo $_SESSION['favcolor'];
> > $_SESSION['favcolor'] = 'green';
> >
> > echo '<br><a href="page2.php">page 2</a>';
> > ?>
> >
> > ----------------------------------------------------
> > page2.php
> > <?php
> > session_start();
> > echo 'page #2<br>';
> >
> > echo $_SESSION['favcolor'];
> > $_SESSION['favcolor'] = 'blue';
> >
> > echo '<br><a href="page1.php">page 1</a>';
> > ?>
> >
> > Actually the above code doesn't initialize the variable as
> > either green or blue. It leaves it blank.
>
> You might want to echo a variable after you set it (page1.php) or after
> you change it (page2.php). :-)
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
>      Coming Fall 2004
> HTTP Developer's Handbook - Sams
>      http://httphandbook.org/
> PHP Community Site
>      http://phpcommunity.org/

That did it! I wonder if there is a way, then, to have it work even if the variable is 
initialized after it is echoed.
I was actually trying to do this to pass values in another script. I'm writing some 
code that has to do with storing and retrieving
images in mysql. I'm having trouble passing image information (the kind needed for 
getimagesize( ) to work) and I can't get session
variables to initalize in that either. More experimentation with echo (and other code) 
placement needed.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to