This is a discussion on Sessions within the PHP Language forums, part of the PHP Programming Forums category; I am confused on how to define $_SESSION['text'] On one page I defined: $_SESSION['picture1_type'] = $_FILES['picture1']['type']; echo $...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am confused on how to define $_SESSION['text']
On one page I defined: $_SESSION['picture1_type'] = $_FILES['picture1']['type']; echo $_SESSION['picture1_type'] ; echo displayed the correct data. image/gif On the next page, I echo: echo "Session 1 = ".$_SESSION['picture1_type']; $ii=1; echo "Session i = ".$_SESSION['picture'.$ii.'_type']; Now both display empty value. Session 1 = Session i = What can make a session variable reset to "" ? The other session variables on all pages work correctly; so it is only this session variable that is resetting. Is it necessary to define a variable on one page and form the session variable on the next pager? Ken |
|
|||
|
"Ken" <kkrolski@wi.rr.com> wrote in message
news:T0SUc.48026$ju6.35460@twister.rdc-kc.rr.com... > I am confused on how to define $_SESSION['text'] > > On one page I defined: > > $_SESSION['picture1_type'] = $_FILES['picture1']['type']; > echo $_SESSION['picture1_type'] ; > > echo displayed the correct data. image/gif > > On the next page, I echo: > > echo "Session 1 = ".$_SESSION['picture1_type']; > $ii=1; > echo "Session i = ".$_SESSION['picture'.$ii.'_type']; > > Now both display empty value. > > Session 1 = Session i = > > What can make a session variable reset to "" ? > > The other session variables on all pages work correctly; so it is only this > session variable that is resetting. > > Is it necessary to define a variable on one page and form the session > variable on the next pager? > > Ken > > > > Did you call session_start() at the beginning of the page? |
|
|||
|
Yes, session_start() is called on each page.
There are other session variables that are working. Ken "kingofkolt" <jessepNOSPAM@comcast.net> wrote in message news:mnVUc.43462$TI1.39357@attbi_s52... > "Ken" <kkrolski@wi.rr.com> wrote in message > news:T0SUc.48026$ju6.35460@twister.rdc-kc.rr.com... > > I am confused on how to define $_SESSION['text'] > > > > On one page I defined: > > > > $_SESSION['picture1_type'] = $_FILES['picture1']['type']; > > echo $_SESSION['picture1_type'] ; > > > > echo displayed the correct data. image/gif > > > > On the next page, I echo: > > > > echo "Session 1 = ".$_SESSION['picture1_type']; > > $ii=1; > > echo "Session i = ".$_SESSION['picture'.$ii.'_type']; > > > > Now both display empty value. > > > > Session 1 = Session i = > > > > What can make a session variable reset to "" ? > > > > The other session variables on all pages work correctly; so it is only > this > > session variable that is resetting. > > > > Is it necessary to define a variable on one page and form the session > > variable on the next pager? > > > > Ken > > > > > > > > > > Did you call session_start() at the beginning of the page? > > |