Forum Moderators: coopster

Message Too Old, No Replies

Simple $ SESSION var assignment wont work

         

homeless

8:37 pm on Aug 28, 2010 (gmt 0)

10+ Year Member



--> $_REQUEST['page'] is equal to 25.

$_SESSION['previous_page'] = $_REQUEST['page']; //RETURNS BLANK/NULL
$_SESSION['previous_page'] = $_REQUEST['page'] + 0; //RETURNS 0
$_SESSION['previous_page'] = "25"; //RETURNS 25

Why won't $_SESSION store an int or a string representing an int but store text?

Anyango

2:46 pm on Aug 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is session_start() being called before storing the seesion variable ? and before reading it ?

homeless

3:07 pm on Aug 29, 2010 (gmt 0)

10+ Year Member



yes. session_start() is always called first in my setup/config routine. session variables are holding text values fine but not this integer for some reason. globals are turned off, so that is not the reason.

impact

12:39 pm on Aug 30, 2010 (gmt 0)

10+ Year Member



I am not very sure but i guess it should be

$_SESSION['previous_page'] = 25; //RETURNS 25