Complicated Page Referral Needs

Links for php scripts

Moderators: macek, egami, gesf

Post Reply
User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Complicated Page Referral Needs

Post by freshnet » Fri Jul 27, 2012 5:30 am

Doing this with string replaces is sort of ugly. I'd recommend either

a) recode the entire site using GET requests so that you can keep the collection in the url and easily get back to it from anywhere

b) store the collection name in a $_SESSION variable and link back to it that way.

User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Complicated Page Referral Needs

Post by freshnet » Sat Jul 28, 2012 2:53 pm

It depends where the collection name is coming from, but it's as simple as doing:

Code: Select all

session_start();
$_SESSION['collection'] = some variable holding your collection name; 
Then to call the variable back again just do something like

Code: Select all

session_start();
$url = 'http://ringsunique.com/openquote/?ring='.$_SESSION['collection'];

User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Complicated Page Referral Needs

Post by freshnet » Sun Jul 29, 2012 3:50 am

You will want to start the session and set the session variable as early in the script as you can. I generally do it at the top of the php file.

Post Reply

Who is online

Users browsing this forum: Mustafa and 2 guests