I tu jest problem gdyż pole ilość jest pobierane z bazy danych co zrobić aby w przypadku wpisania innej wartości przez użytkownika ta wartość z bazy została nadpisana.
Poniżej link -> http://alkomatydowodowe.pl/index.php?p=cart (trzeba wrzucić jakiś produkt do koszyka)
Poniżej kod:
$html .= '<table cellspacing="2" cellpadding="0" align="center" style="margin-top:10px;">'; $html .= '<form name="cart_recount" method="POST" action="index.php">'; $html .= '<input type="HIDDEN" name="p" value="cart">'; $html .= '<input type="HIDDEN" name="recount" value="true">'; $html .= '<tr>'; // pozycje $query = mysql_query("SELECT *,cart.id AS item FROM cart LEFT JOIN product ON cart.pid = product.id WHERE session='".session_id()."' LIMIT 0,10;"); { $html .= '<td style="width:40px; height:30px; background-color:#ffffff; border-style:solid; border-color:#ececec; border-width:1px; text-align:center; vertical-align:middle;" class="cart_main_item"> <input id="pole" type="TEXT" name="quantity_'.$cartitem['id'].'" value="'.$cartitem['quantity'].'" //ti jest wartosc wpisywana w pole ilość class="cart_main_item" style="border-style:none; background-color:#ffffff; width:40px; padding:0px 0px 0px 0px; text-align:center;"></td>'; $html .= '<td style="width:80px; height:30px; background-color:#ffffff; border-style:solid; border-color:#ececec; border-width:1px; text-align:center; vertical-align:middle; font-weight:bold;" class="cart_main_item">'.number_format(($cartitem['quantity']*$cartitem['pricewithtax_discount']),2,',',' ').'zł<br>z VAT</td>'; $html .= '<td style="width:25px; height:30px; background-color:#ffffff; border-style:solid; border-color:#ececec; border-width:1px; text-align:center; vertical-align:middle;" class="cart_main_item"><A href="index.php?p=cart&delete='.$cartitem['item'].'"><img src="layout/'.$style.'/delete.png" alt="" title="" border="0" style="width:20px; height:20px;"></a></td>'; $html .= '</tr>'; $sum += ($cartitem['quantity']*$cartitem['pricewithtax_discount']); } // podusmowenie cen $html .= '</form>'; $html .= '<tr>'; $html .= '<td style="width:25px; height:30px; background-color:#ffffff; border-style:solid; border-color:#ffffff; border-width:1px; text-align:left; vertical-align:middle;" class="cart_main_top" colspan="6">'; $html .= '<img onClick="document.cart_recount.submit();" src="layout/'.$style.'/cart_recount_off.png" onMouseOver="this.src='."'layout/".$style."/cart_recount_on.png'".';" onMouseOut="this.src='."'layout/".$style."/cart_recount_off.png'".';" alt="" title="" border="0" style="cursor:pointer;">'; //tu jest przycisk do przeliczania cena*ilosc $html .= '<img src="layout/'.$style.'/cart_recount_on.png" alt="" title="" border="0" style="display:none;">'; $html .= '</td>'; $html .= '<td style="width:80px; height:30px; background-color:#ececec; border-style:solid; border-color:#dddddd; border-width:1px; text-align:center; vertical-align:middle; font-weight:bold;" class="cart_main_top">'.number_format($sum,2,',',' ').'zł<br>z VAT</td>'; $html .= '<td style="width:25px; height:30px; background-color:#ffffff; border-style:solid; border-color:#ffffff; border-width:1px; text-align:center; vertical-align:middle;" class="cart_main_top"> </td>'; $html .= '</tr>'; $html .= '</table>';