questions about sessions...

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
User avatar
boo_lolly
Forum Contributor
Posts: 154
Joined: Tue Nov 14, 2006 5:04 pm

questions about sessions...

Post by boo_lolly »

i'm building a small CMS to be integrated with a third party shopping cart... this CMS is a bridal registry, with admin and public pages. the admin adds products to a bridal registry using the admin pages... then, the public can view a registry that has products that the admin pulled from the shopping cart database... and then purchase an item from the registry.

the difficulty involved comes from how crazy this third party shopping cart is... it's extremely difficult to work with, and confusing... it's weird, when you click 'Add to cart', you are taken to the shopping cart page, and the correct item is in the cart... but NONE of the rest of the information gets sent (unique id's, registry id's...ect...). it's so weird i have no idea how to make it work... so, i was thinking about FORCING information to be sent from page to page... then i came across sessions...

i guess what i'm asking is can sessions help my current situation? i just need to pass along a few values for a few variables for each individual public user... i'm pretty sure sessions can do this for me, but i have no idea where to start.. does anybody have any tips, code examples, explanations, anything that can get me on my way??? thanks in advanced.

-boo
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Read the manual on sessions. Then look at session_start() and go from there.
User avatar
boo_lolly
Forum Contributor
Posts: 154
Joined: Tue Nov 14, 2006 5:04 pm

Post by boo_lolly »

thanks roopurt. i was wondering, is it possible to have a nested session array? for instance... if i have multiple values for $_SESSION['price']... is it possible to add an index to this session? or would i be adding on an index to the array $price, and then storing the $price array as a session array $_SESSION['price']?

$price = array(12, 41, 15, 22, ... ect...);

$price = array(12, 41, 15, 22, ... ect...) ... add another index to the array....

$_SESSION['price'] = $price

is this possible?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

boo_lolly wrote:thanks roopurt. i was wondering, is it possible to have a nested session array? for instance... if i have multiple values for $_SESSION['price']... is it possible to add an index to this session? or would i be adding on an index to the array $price, and then storing the $price array as a session array $_SESSION['price']?

$price = array(12, 41, 15, 22, ... ect...);

$price = array(12, 41, 15, 22, ... ect...) ... add another index to the array....

$_SESSION['price'] = $price

is this possible?
Try it.
User avatar
evilchris2003
Forum Contributor
Posts: 106
Joined: Sun Nov 12, 2006 6:43 am
Location: Derby, UK

Post by evilchris2003 »

experimentation is most definatly the key
Post Reply