I was trying to display a link in a page which will point to previous page the user has visited in drupal . Previously i was using sessions
echo $_SESSION['back']
$_SESSION['back']=htmlentities($_SERVER['REQUEST_URI']);
This worked fine, but i was told to use variable_get and set in drupal and not to use sessions So i did this
global $prev_global;
$prev_global=variable_get($prev_page,$default='http://mysite.local');
variable_set($prev_page,htmlentities($_SERVER['REQUEST_URI']));
. . .
echo "PREV:".$prev_global;
But this always points to the current page being viewed , what went wrong here ?