PHP how to store text values in existsing session structure?

cjconnor24

New member
Ok this is a bit of a tough one to describe - i basically have a shopping cart (session) which works fine.

The structure is as follows:

$_SESSION['cart'][(productid)][(pricingoption)] = $qty;

so an example with product 4 and pricing option 3 might look like this:

$_SESSION['cart'][4][3] = 1;

As i say, this works great. I now want to add options which would generate dynamic text boxes per product. i.e. for business cards.

In my database i have a field where i can store the initial fields like so

"Name|Job Title|Telephone"

these are then exploded to create the text boxes like so

$options = explode("|",$data->options);

foreach($options as $key=>$value){
#... GENERATE THE TEXT BOXES
}

Again this works fine.

This is where i'm stuck - how can i get these values and store them in the above cart? Even if i could store them as an array.

I should say that not every product will have options so this has to be dynamic.

If you need any more info please just ask.
 
Back
Top