Z góry dziękuje za każdą podpowiedz
CODE
<?php
include 'config.php';
db_connect();
check_login();
$pagetitle = 'Koszyk';
require_once ('templates/userheader.html');
if (isset($_POST['changepieces'])) {
$cart_id = $_POST['cart_id'];
$product_pieces = $_POST['product_pieces'];
echo '<p>Zmieniles ilosc wybranego produktu w koszyku !</p>';
mysql_query("UPDATE `carts` SET product_pieces = '{$_POST['product_pieces']}' WHERE cart_id = '{$_POST['cart_id']}'") or die("blad");
}
echo '<table align="center" border="1" width="500px">
<h2>Twój koszyk</h2>
<tr>
<th>Nazwa</th>
<th>Cena</th>
<th>Ilosc</th>
<th>Zmien</th>
</tr>';
$result = mysql_query("SELECT * FROM `carts` WHERE `user_id` = '{$_SESSION['user_id']}'");
while($row = mysql_fetch_assoc($result)) {
echo '<tr>
<td><b>'.$row['product_name'].'</b></td>
<td>'.$row['product_price'].'zł</td>
<td>'.$row['product_pieces'].'szt</td>
<td><form method="post" action="'.$_SERVER['PHP_SELF'].'">
<input type="text" id="product_pieces" name="product_pieces" size="2" value="" />
<input type="hidden" id="cart_id" name="cart_id" value="'.$row['cart_id'].'" />
<input type="submit" value="Zmien ilosc" name="changepieces" /></td>
</tr> ';
}
db_close();
?>
include 'config.php';
db_connect();
check_login();
$pagetitle = 'Koszyk';
require_once ('templates/userheader.html');
if (isset($_POST['changepieces'])) {
$cart_id = $_POST['cart_id'];
$product_pieces = $_POST['product_pieces'];
echo '<p>Zmieniles ilosc wybranego produktu w koszyku !</p>';
mysql_query("UPDATE `carts` SET product_pieces = '{$_POST['product_pieces']}' WHERE cart_id = '{$_POST['cart_id']}'") or die("blad");
}
echo '<table align="center" border="1" width="500px">
<h2>Twój koszyk</h2>
<tr>
<th>Nazwa</th>
<th>Cena</th>
<th>Ilosc</th>
<th>Zmien</th>
</tr>';
$result = mysql_query("SELECT * FROM `carts` WHERE `user_id` = '{$_SESSION['user_id']}'");
while($row = mysql_fetch_assoc($result)) {
echo '<tr>
<td><b>'.$row['product_name'].'</b></td>
<td>'.$row['product_price'].'zł</td>
<td>'.$row['product_pieces'].'szt</td>
<td><form method="post" action="'.$_SERVER['PHP_SELF'].'">
<input type="text" id="product_pieces" name="product_pieces" size="2" value="" />
<input type="hidden" id="cart_id" name="cart_id" value="'.$row['cart_id'].'" />
<input type="submit" value="Zmien ilosc" name="changepieces" /></td>
</tr> ';
}
db_close();
?>