...

View Full Version : session not passing from page to page



o0katz0o
05-21-2004, 05:15 AM
ok so I have this code:


$reso = $_GET['r'];
if ($reso == 2)
$_SESSION['reso'] = $reso;
else if ($reso == 1)
$_SESSION['reso'] = $reso;


this sets $_SESSION to whatever to $reso number is, if it is in the URL ie: mysite.com/index.php?r=1
however if the page is just normal mysite.com/index.php
The session is unset for some reason, and it is not passed onto the next page

what is wrong with this?

DiarYofaMadmaN
05-21-2004, 07:12 AM
ok so I have this code:


$reso = $_GET['r'];
if ($reso == 2)
$_SESSION['reso'] = $reso;
else if ($reso == 1)
$_SESSION['reso'] = $reso;


this sets $_SESSION to whatever to $reso number is, if it is in the URL ie: mysite.com/index.php?r=1
however if the page is just normal mysite.com/index.php
The session is unset for some reason, and it is not passed onto the next page

what is wrong with this?

You must have session_start(); as the very first line of coding on each page you want to use sessions on...

-peace

o0katz0o
05-21-2004, 07:24 AM
i do have session_start() at the beginning of the line
I have it retrieving from a db instead now, although i still don't understand WHY that code wasn't working, considering i have other SESSION variables right under that line that works perfectly.
oh well, what a mystery



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum