I have a simple shopping cart system , how to list all the registered session as shown below:
<?php
if(isset($_SESSION['prod'][$_GET['id']])){
// How to list all $_SESSION['prod']['variable_here'] ?;
}
?>
I have a simple shopping cart system , how to list all the registered session as shown below:
<?php
if(isset($_SESSION['prod'][$_GET['id']])){
// How to list all $_SESSION['prod']['variable_here'] ?;
}
?>
Use this,
As seesion is an array in php, you can php array functions for that.
if(!empty($_SESSION))
echo "<pre>"; print_r($_SESSION);exit;
Not sure i understand exactly what are you asking. Anyway, you may try this to list all your sessions.
if(isset($_SESSION['prod'][$_GET['id']]))
{
// suppose that session is an array
foreach ($_SESSION['prod'] as $session)
{
echo $session; // supposedly you want to echo it?
}
}
Is this what you want to achieve? Regards Vladimir