Hi,
I'm kind of new to php, and while I figured out most of the most common stuff, I have problems with sessions. So, first of all I apologize for my incompetence and ignorance, and please forgive me if I will not be completelly clear.
I have a 3 page website and in all the pages I have started a session.
1) Home page, nothing special;
2) Catalog page, where the items are shown;
3) sort of "cart" page, where all the items chosen by the user are shown.
Now, I have problems concerning this last step. I can't find a way to show ALL the items chosen, but only the last one... If you guys can help me it will be really appreciate!
Here's the code I'm struggling with, probably is all crap:
<?php
$code = $_GET['code']; //this is the item's code passed through the URL
$i=0; // setting a counter
while ($i < count($_SESSION[$i]))
{
if (empty($_SESSION['$i']))
{
$_SESSION['$i'] = $code;
}
$i++;
}
// NOW THERE SHOULD BE A $_SESSION[$i] FOR EACH ITEM VISITED, RIGHT?
foreach ($_SESSION as $key => $val)
{
echo "$val <br>";
}
All suggestions are welcome!
Ciao!