I created in Array and everytime i output it, there is only one row shown. I want to show every row. Here is the code:
//Input in Array
$_SESSION['warenkorb'][] = array('warenkorb_id' => $_POST['a_id_warenkorb'], 'buchtyp' => $_POST ['buchtyp'], 'menge' => $_POST['menge']);
//Array Output
foreach ($_SESSION['warenkorb'] as $index => $inhalt);
{
echo $inhalt['warenkorb_id'];
echo $inhalt['buchtyp'];
echo $inhalt['menge'];
}
I hope someone can help me :) Lukas
Remove semicolon(";") at end of foreach.
foreach ($_SESSION['warenkorb'] as $index => $inhalt)
session_start();
at start of fileTry This
<?php
session_start();
$_SESSION['warenkorb'][] = array('warenkorb_id' => $_POST['a_id_warenkorb'], 'buchtyp' => $_POST ['buchtyp'], 'menge' => $_POST['menge']);
//Array Output
foreach ($_SESSION['warenkorb'] as $index => $inhalt);
{
echo $inhalt['warenkorb_id'];
echo $inhalt['buchtyp'];
echo $inhalt['menge'];
}
?>