Forum Moderators: coopster

Message Too Old, No Replies

Storing a URL string into a session variable

is it possible and how is it done?

         

screwfacecapone

4:27 pm on Dec 15, 2005 (gmt 0)

10+ Year Member



I'm wondering is there is a way to store the URL of a page into a session variable. I would then use this to create a hyperlink to the page.

Anyango

7:13 pm on Dec 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



definitely yes!

<?
session_start();
$_SESSION['url']="http://examplewebsite.com";
?>

then to link it you can simply write

<a href="<?echo $_SESSION['url'];?>">Example</a>

unless if i couldnt understand your post correctly

screwfacecapone

3:33 am on Dec 16, 2005 (gmt 0)

10+ Year Member



Thanks, although what I was wondering if there was a way to store the URL of a page you are currently on into a php variable.

coopster

2:11 pm on Dec 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have a look at some of the $_SERVER variables, like PHP_SELF or REQUEST_URI. Remember though, they are user-supplied data.

screwfacecapone

3:11 pm on Dec 16, 2005 (gmt 0)

10+ Year Member



Thanks a lot.