Witam,
mam problem - jest sobie skrypt:
function odbierz($txt) {
}
$id = odbierz($_REQUEST["id"]);
if ($id<>"") {
$wynik = mysql_query("SELECT * FROM ehi_produkty WHERE id_produktu='$id'"); }
$_SESSION["koszyk"]["$id"]["towar"]=$dane["nazwa"];
$_SESSION["koszyk"]["$id"]["cena"]=$dane["cena_detaliczna"];
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
) { <colgroup>
<col />
<col align=\"right\" />
<col align=\"center\" />
<col align=\"center\" />
<col align=\"right\" />
</colgroup>
<tr><th bgcolor=#9999ff>towar</th><th bgcolor=#9999ff>cena</th><th bgcolor=#9999ff>sztuk</th><th bgcolor=#9999ff>łącznie</th></tr>";
foreach($_SESSION["koszyk"] as $indeks=>$kosz) {
echo "<td>{$kosz["towar
"]}</td>"; echo "<td align=right>{$kosz["cena
"]} zł</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>";
$lacznie +=$kosz["cena"]*$kosz["ile"];
}
echo "<tr><td colspan=\"3\" align=\"right\"> <b>w sumie: </td><td align=right><b>";
i do niego dodałam:
function odbierz($txt) {
}
$id = odbierz($_REQUEST["id"]);
if ($id<>"") {
$wynik = mysql_query("SELECT * FROM ehi_produkty WHERE id_produktu='$id'"); }
$_SESSION["koszyk"]["$id"]["towar"]=$dane["nazwa"];
$_SESSION["koszyk"]["$id"]["cena"]=$dane["cena_detaliczna"];
$_SESSION["koszyk"]["$id"]["gabaryty"]=$dane["gabaryty"];
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
) { <colgroup>
<col />
<col align=\"right\" />
<col align=\"center\" />
<col align=\"center\" />
<col align=\"right\" />
</colgroup>
<tr><th bgcolor=#9999ff>towar</th><th bgcolor=#9999ff>gabaryt</th><th bgcolor=#9999ff>cena</th><th bgcolor=#9999ff>sztuk</th><th bgcolor=#9999ff>łącznie</th></tr>";
foreach($_SESSION["koszyk"] as $indeks=>$kosz) {
echo "<td>{$kosz["towar
"]}</td>"; echo "<td>{$kosz["gabaryty
"]}</td>"; echo "<td align=right>{$kosz["cena
"]} zł</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>";
$lacznie +=$kosz["cena"]*$kosz["ile"];
}
echo "<tr><td colspan=\"3\" align=\"right\"> <b>w sumie: </td><td align=right><b>";
czyli zmienna gabaryty. Niestety zmienna gabaryty nie chce się wyświetlać.
Gdzie robie błąd?
Ten post edytował agataperz 7.10.2011, 17:38:32