這是分配,所以沒有尋找任何完全安全和可靠的工作。我在SQL數據庫中有表格,我正在打印所有記錄,所有記錄都有唯一的參考編號,對於我打印的每一行數據庫給了行的ref的值的複選框。號,當我用「POST」一切工作,並打印出它們提交:如何將數組放入會話?
if (!$_POST['checkbox']) {
echo "Your basket is empty.";
} else {
echo "<table border='0' id='games_table' cellspacing='1'>";
echo "<tr id='basket_table_row'>";
echo "<td colspan='3'>" . "Logged: " . $_SESSION['user'] . "</td>";
echo "<td colspan ='2'>" . "OS used on this machine: " . "<script type='text/javascript'>document.write(yourOS())</script><noscript>Computers</noscript>" . "</td>";
echo "</tr>";
echo "<tr id='basket_table_row'>";
echo "<td colspan='5'>" . "You put into the basket these games: " . "</td>";
echo "</tr>";
foreach ($_POST['checkbox'] as $value) {
$_SESSION['basket']=array($value);
$res=pg_query($conn,"select * from CSGames where refnumber='$value'");
while ($a = pg_fetch_array ($res)) {
echo "<tr id='games_table_row'>";
echo "<td>" . $a["refnumber"] . "</td>";
echo "<td>" . $a["title"] . "</td>";
echo "<td>" . $a["platform"] . "</td>";
echo "<td>" . $a["description"] . "</td>";
echo "<td>" . $a["price"] . "</td>";
echo "</tr>";
}
}
echo "</table>\n";
}
但只認爲它可以停留記錄在$ _SESSION [「籃子」]是最後一個複選框的價值,但我需要所有的人(60或70)。 我做錯了什麼?
你需要我們展示更多。你的請求沒有任何意義。 –