我在Array中创建,每次输出时,只显示一行。我想展示每一行。 这是代码:
//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'];
}
我希望有人可以帮助我:) 卢卡斯
答案 0 :(得分:0)
在foreach结束时删除分号(“;”)。
foreach ($_SESSION['warenkorb'] as $index => $inhalt)
答案 1 :(得分:0)
session_start();
醇>
试试这个
<?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'];
}
?>