Wow thanks. I appreciate it.
There's probrobly a shorter way of doing this.
I had help from a different forum and this is what I have.
<?php
session_start();
if(isset($_POST['product'])) # or however you want to check that something is posted
{
$thisItem['qty'] = $_POST['quantity'];
$thisItem['product'] = $_POST['product'];
$thisItem['color'] = $_POST['color'];
$thisItem['size'] = $_POST['size'];
$_SESSION['items'][] = $thisItem; # add array to session 'items' array
}
?>
When it needs to be displayed...
<?php
if(isset($_SESSION['items']) and count($_SESSION['items']) > 0)
{
echo "<ol>\n";
foreach($_SESSION['items'] as $ix => $val) # val will be an array
{
echo "<li>({$val['qty']}) - {$val['product']}, {$val['color']}, {$val['size']}</li>\n";
}
echo "</ol>\n";
} ?>
I don't know if it's better, but it works and I'm happy. I do have a question about these type of arrays though, maybe you can help. First off, I don't know much about arrays. I kinda understand how to gat vars from arrays, but I'm not sure how to grab specific things like the quantity from product3 (example).
The second thing is that I've read about deleting array vars in the front and back, but what if someone wants to remove a product from the middle? I'd like to have a "remove" button by each row, but is it possible to remove items from the middle?
Anyway, thanks a lot for the code and help. I really appreciate it!