[PHP] Storing a link

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

[PHP] Storing a link

Post by thiscatis »

I'm currently working on a shopping cart system for a school project and one of group members pointed out an inconvenience.
When you add a product to your basket your redirected to a registration page to create an account (with your personal basket).
This is how the system should work. (I'd prefer cookie storage and when registered to a database, but hey, i'm not the teacher).
Anyway.. imagine you're browsing in a rather large store for a product, you finally got it and then you press "add to basket" and you need
to register, once registered you have to do the search process all over again. In a marketing way, this is not good.
So is there a way to store the "came from" link over a few pages?

1. So user is on a certain page [this is the url that needs to be stored]
2. User clicks on add product, is redirected to register.php
3. User registers (register function is in functions.php)
4. When registered he is redirected to the register_success.php page
5. And from here he should be able to be redirected to the url from step one.

Anyone?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

store it in a session variable.
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

Could you point me in the right direction with some starting code or a structure?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

:?

Code: Select all

$_SESSION['someName'] = $url;
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

aah, sorry :)
Post Reply