PHP ver gevorderde |
|
<?
session_start();
if(!isset($_SESSION['producten']) || !is_array($_SESSION['producten']))
{
$_SESSION['producten'] = array();
}
function NewProduct($aantal, $product_ID)
{
$_SESSION['producten'][] = array($aantal, $product_ID)
}
function DeleteProduct($ArrayKey)
{
unset($_SESSION['producten'][$ArrayKey]);
}
function ShowProcducts()
{
if(count($_SESSION['producten']) > 0)
{
foreach($_SESSION['producten'] as $k => $v)
{
echo $v[1] .' => '. $v[0] .' keer<br />';
}
}
}
?>
<? if(!isset($_SESSION['producten']) || !is_array($_SESSION['producten'])) { $_SESSION['producten'] = array(); } function NewProduct($aantal, $product_ID) { $_SESSION['producten'][] = array($aantal, $product_ID) } function DeleteProduct($ArrayKey) { unset($_SESSION['producten'][$ArrayKey]); } function ShowProcducts() { if(count($_SESSION['producten']) > 0) { foreach($_SESSION['producten'] as $k => $v) { echo $v[1] .' => '. $v[0] .' keer<br />'; } } } ?>
zoiets is het idee? |