so gehts:
index.php:
index2.php:
index.php:
PHP-Code:
<?php
session_start();
$_SESSION['Warenkorb'];
echo $PHPSESSID;
echo"
<form action=\"index2.php\" method=\"get\">
<input type=\"hidden\" name=\"produktname\" value=\"Felgen\">
<input type=\"hidden\" name=\"anzahl\" value=\"5\">
<INPUT TYPE=submit value=Bestellen ></form>
";
echo"
<form action=\"index2.php\" method=\"get\">
<input type=\"hidden\" name=\"produktname\" value=\"Sitze\">
<input type=\"hidden\" name=\"anzahl\" value=\"2\">
<INPUT TYPE=submit value=Bestellen ></form>
";
echo"
<form action=\"index2.php\" method=\"get\">
<input type=\"hidden\" name=\"produktname\" value=\"Tuning\">
<input type=\"hidden\" name=\"anzahl\" value=\"2\">
<INPUT TYPE=submit value=Bestellen ></form>
";
echo "<a href=\"index2.php\">linkw</a>";
?>
index2.php:
PHP-Code:
<?php
session_start();
//$_SESSION['Warenkorb']= array ();
//$meineWaren=array();
$_SESSION['Warenkorb'];
$Warenkorb[$produktname] = $anzahl;
$_SESSION['Warenkorb'];
foreach ($_SESSION['Warenkorb'] as $key => $value) {
echo "Das Produkt $key wurde $value x bestellt<br>\n";
}
echo "<a href=\"index.php\">linkw</a>";
?>
Kommentar