Nic takiego w kodzie nie ma. To jest ten kod:
<?
session_start();
?>
<?='<?xml version="1.0" encoding="utf-8"?>';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl"><head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
<title>tytuł strony</title></head><body>
<p><b>Koszyk</b> / <a href="index.php">wróć do towarów</a>/ <a href="dane.php">dane</a></p>
<?
$sql_serwer = "";
$sql_login = "";
$sql_haslo = "";
$sql_baza = "";
$sql_tabela = "produkty";
function odbierz($txt) {
if (get_magic_quotes_gpc()) $txt = stripslashes($txt);
return str_replace(array('\\',"'"), array('\\\\',"\'"), trim($txt));
}
$id = odbierz($_REQUEST["id"]);
$sz = isset($_REQUEST["sz"])?number_format($_REQUEST["sz"],0,".",""):"";
if ($id<>"") {
if (mysql_connect($sql_serwer, $sql_login, $sql_haslo)
and mysql_select_db($sql_baza)) {
$wynik = mysql_query("SELECT * FROM $sql_tabela WHERE id='$id'");
mysql_close();
}
if ($wynik and mysql_num_rows($wynik)==1) {
$dane = mysql_fetch_array($wynik);
$_SESSION["koszyk"]["$id"]["towar"]=$dane["towar"];
$_SESSION["koszyk"]["$id"]["cena"]=$dane["cena"];
$_SESSION["koszyk"]["$id"]["rozmiar"]=$_GET["rozmiar"];
if ($sz=="") $_SESSION["koszyk"]["$id"]["ile"]++;
else if ($sz>=1) $_SESSION["koszyk"]["$id"]["ile"]=$sz;
else if ($sz<=0) unset($_SESSION["koszyk"]["$id"]);
}
}
if (count($_SESSION["koszyk"])>0) {
echo "<table border=\"1\">
<colgroup>
<col />
<col align=\"right\" />
<col align=\"center\" />
<col align=\"right\" />
</colgroup>
<tr><th>towar</th><th>cena</th><th>sztuk</th><th>łącznie</th></tr>";
foreach($_SESSION["koszyk"] as $indeks=>$kosz) {
$laczniesztuk +=$kosz["ile"];
$cena = $kosz["cena"];
$towar .= $kosz["towar"];
$towar .= "<br />Rozmiar: ";
$towar .= $kosz["rozmiar"];
echo "<tr>";
echo "<td>$towar</td>";
echo "<td>$cena zł</td>";
echo "<td>
<form action=\"koszyk.php\" method=\"get\" style=\"display:inline;\">
<div style=\"display:inline;\">
<input type=\"hidden\" name=\"id\" value=\"$indeks\" />
<input type=\"text\" name=\"sz\" value=\"{$kosz["ile"]}\"
style=\"width:25px;\" />
<input type=\"submit\" value=\"zmień\" style=\"width:45px;\" />
</div></form>
<form action=\"koszyk.php\" method=\"get\" style=\"display:inline;\">
<div style=\"display:inline;\">
<input type=\"hidden\" name=\"id\" value=\"$indeks\" />
<input type=\"hidden\" name=\"sz\" value=\"0\"
style=\"width:25px;\" />
<input type=\"submit\" value=\"usuń\" style=\"width:45px;\" />
</div></form>
</td>";
echo "<td>".number_format($cena*$kosz["ile"],2,".","");
echo " zł</td>";
echo "</tr>";
$lacznie +=$cena*$kosz["ile"];
$laczniesztuk +=$kosz["ile"];
}
echo "<tr><td colspan=\"3\" align=\"right\">
w sumie: </td><td>";
echo number_format($lacznie,2,".","")." zł</td></tr>";
echo "</table>";
} else echo "<p>Koszyk jest pusty...</p>";
?>
</body>
</html>