$numer = (int)$_POST['ilosc']; } else { $numer=10; } $numer--; } $numer++; } foreach ($_SESSION['koszyk'] as $key => $produkt) { $key=$key+1; } }
Ktos cos? Bo serio od wczoraj utknelam

$numer = (int)$_POST['ilosc']; } else { $numer=10; } $numer--; } $numer++; } foreach ($_SESSION['koszyk'] as $key => $produkt) { $key=$key+1; } }
$numer = (int)$_POST['ilosc']; } else { $numer=1; } $numer--;} } $numer++; } foreach ($_SESSION['koszyk'] as $key => $produkt) { $key=$key+1; }
<input type=hidden name=key value=$key/>
$_SESSION['koszyk'][$productKey]['ilosc']++; }
<?php 'kategoria' => 'bluzki', 'nazwa' => 'Lewis', 'rozmiar' => 'xl', 'cena' => 20.50, 'ilosc' => '' ), 'kategoria' => 'spodnie', 'nazwa' => 'Lee', 'rozmiar' => 31, 'cena' => 99.50 ), 'kategoria' => 'bluzki', 'nazwa' => 'Modoo', 'rozmiar' => 'l', 'cena' => 29.90 ), 'kategoria' => 'spodnie', 'nazwa' => 'Wrangler', 'rozmiar' => 28, 'cena' => 100.50 ), 'kategoria' => 'bluzki', 'nazwa' => 'Cropp', 'rozmiar' => 'l/xl', 'cena' => 29.50 ), 'kategoria' => 'spodnie', 'nazwa' => 'BigStar', 'rozmiar' => 30, 'cena' => 89.50 ) ); $idProduktu=$_POST['wybrany_produkt']; $_SESSION['koszyk'][] = $produkty[$idProduktu]; } ?> <html> <head> <meta charset="UTF-8"> <style> #komunikat { position: absolute; width: 100%; text-align: center; top: 50px; font-weight: bolder; color: #8b0000; } #produkty { width: 100%; text-align: center; } #produkty th { padding: 4px; background-color: #eee; } #produkty td { padding: 4px; } h1 { margin-top: 100px; text-align: center; } #obrazek { width: 150px; position: absolute; top:0px; right:0px; } #koszyk { width: 150px; height: 80px; } #liczbaProduktow { width: 20px; height: 20px; text-align: center; position: absolute; left:0px; top:-15px; font-weight: bolder; } </style> </head> <body> <div id="obrazek"> <a href=""><img src="""/></a> <p id="liczbaProduktow"> <?php } ?> </p> </div> <h1>Produkty</h1> <form method="post"> <table id="produkty"> <tr> <th>Kategoria</th> <th>Nazwa</th> <th>Rozmiar</th> <th>Cena</th> <th>Opcje</th> </tr> <?php foreach ($produkty as $key => $produkt) { } ?> </table> </form> </body> <script> setTimeout(function(){ document.getElementById('komunikat').style.display = 'none'; }, 2000); </script> </html>
<?php } ?> <html> <head> <meta charset="UTF-8"> <style> #produkty { width: 100%; text-align: center; } #produkty th { padding: 4px; background-color: #eee; } #produkty td { padding: 4px; } h1 { margin-top: 50px; text-align: center; } #napisPusty { width:150px; margin: auto; } #ilosc { width:25px; text-align: center; } </style> </head> <body> <h1>Koszyk</h1> <?php } else { ?> <form method="post"> <table id="produkty"> <tr> <th>Id</th> <th>Kategoria</th> <th>Nazwa</th> <th>Rozmiar</th> <th>Cena</th> <th>Ilosc</th> <th>Usuń</th> <th>Suma</th> </tr> <?php $numer = (int)$_POST['ilosc']; } else { $numer=1; } $numer--;} } $numer++; } foreach ($_SESSION['koszyk'] as $key => $produkt) { } } ?> </table> </body> </html>
<?php 'kategoria' => 'bluzki', 'nazwa' => 'Lewis', 'rozmiar' => 'xl', 'cena' => 20.50 ), 'kategoria' => 'spodnie', 'nazwa' => 'Lee', 'rozmiar' => 31, 'cena' => 99.50 ), 'kategoria' => 'bluzki', 'nazwa' => 'Modoo', 'rozmiar' => 'l', 'cena' => 29.90 ), 'kategoria' => 'spodnie', 'nazwa' => 'Wrangler', 'rozmiar' => 28, 'cena' => 100.50 ), 'kategoria' => 'bluzki', 'nazwa' => 'Cropp', 'rozmiar' => 'l/xl', 'cena' => 29.50 ), 'kategoria' => 'spodnie', 'nazwa' => 'BigStar', 'rozmiar' => 30, 'cena' => 89.50 ) ); $idProduktu=$_POST['wybrany_produkt']; $_SESSION['koszyk'][$idProduktu]['ilosc']++; } else { $_SESSION['koszyk'][$idProduktu] = $produkty[$idProduktu]; $_SESSION['koszyk'][$idProduktu]['ilosc'] = 1; } } ?> <html> <head> <meta charset="UTF-8"> <style> #komunikat { position: absolute; width: 100%; text-align: center; top: 50px; font-weight: bolder; color: #8b0000; } #produkty { width: 100%; text-align: center; } #produkty th { padding: 4px; background-color: #eee; } #produkty td { padding: 4px; } h1 { margin-top: 100px; text-align: center; } #obrazek { width: 150px; position: absolute; top:0px; right:0px; } #koszyk { width: 150px; height: 80px; } #liczbaProduktow { width: 20px; height: 20px; text-align: center; position: absolute; left:0px; top:-15px; font-weight: bolder; } </style> </head> <body> <div id="obrazek"> <a href=""><img src="""/></a> <p id="liczbaProduktow"> <?php } ?> </p> </div> <h1>Produkty</h1> <form method="post"> <table id="produkty"> <tr> <th>Kategoria</th> <th>Nazwa</th> <th>Rozmiar</th> <th>Cena</th> <th>Opcje</th> </tr> <?php foreach ($produkty as $key => $produkt) { } ?> </table> </form> </body> <script> setTimeout(function(){ document.getElementById('komunikat').style.display = 'none'; }, 2000); </script> </html>
<?php } ?> <html> <head> <meta charset="UTF-8"> <style> #produkty { width: 100%; text-align: center; } #produkty th { padding: 4px; background-color: #eee; } #produkty td { padding: 4px; } h1 { margin-top: 50px; text-align: center; } #napisPusty { width:150px; margin: auto; } #ilosc { width:25px; text-align: center; } </style> </head> <body> <h1>Koszyk</h1> <?php } ?> <form method="post"> <table id="produkty"> <tr> <th>Id</th> <th>Kategoria</th> <th>Nazwa</th> <th>Rozmiar</th> <th>Cena</th> <th>Ilosc</th> <th>Usuń</th> <th>Suma</th> </tr> <?php foreach($_POST['ilosc'] as $key => $ilosc) { if ($ilosc > 0) { $_SESSION['koszyk'][$key]['ilosc'] = (int) $ilosc; } } } $_SESSION['koszyk'][$_POST['plus']]['ilosc']++; $_SESSION['koszyk'][$_POST['minus']]['ilosc']--; if ($_SESSION['koszyk'][$_POST['minus']]['ilosc'] < 1) { } } } foreach ($_SESSION['koszyk'] as $key => $produkt) { } ?> </table> </form> </body> </html>