boo_lolly Posted December 8, 2006 Share Posted December 8, 2006 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 Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted December 8, 2006 Share Posted December 8, 2006 yes, they can help you.I worked up this on my site, www.freelancebusinessman.comunder tutorials, there is a tutorial for this, it's a little outdated, as far as compared to my current knowledge, and is probably due for another rewrite in a few months.I will probably rewrite the whole thing, and triple the information in it, but it will give you a basic idea of how everything works, come back here afterwards if you have any more questions. Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted December 8, 2006 Author Share Posted December 8, 2006 wow business, great site, and great tutorial! i am definitely more familiar with sessions after reading it. i have a question... since the shopping car has it's own session... should i add another one for this registry? or should i be able to use the shopping cart session WITH the registry? that would be best...either way, i am curious to see if more than one session can even be called on the same page... and what you would be afforded by doing so, if possible... Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted December 8, 2006 Share Posted December 8, 2006 There is only one session per user. You call session_start() at the top of every page where you intend to use the $_SESSION array. Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted December 8, 2006 Author Share Posted December 8, 2006 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'] = $priceis this possible? and how do i "append" to an array another index and store associative values in this new index?? Quote Link to comment Share on other sites More sharing options...
linuxdream Posted December 9, 2006 Share Posted December 9, 2006 Yes you can have arrays in a session array. You can even put objects in there. It functions just like any other array, only it's data is available to you across the site (with enabled sessions of course). What you did was correct for adding another array to the $_SESSION['price'] key. So you could do[code]<?php$_SESSION['moreprices'] = array('something', 'else', array('and', 'again'));?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.