I may have coded myself into a corner here.
I need to update the quantities in a shopping cart software I am developing.
I am using a while loop to pull from a database to insert each item into the cart for check out.
I want to put 1 button called 'update' at the bottom of the form. when it's pressed i need to grab all the quantities from the form and see if they changed.
I know how to do this with form fields that i have created out manually, but i cannot figure out how to do this with form fields that php created during a while loop.
here is what i have for the while loop.
i know there are some problems with my Mysql coding (I am still learning to understand the Join command.)
$qtyctr = 0;
while($row = mysql_fetch_array($get_prods)){
$pid = $row['pid'];
$qty = $row['qty'];
//get some information about the product.
$getpinfo = mysql_query("SELECT p_name,p_distrip,p_matrix,p_altprice FROM products WHERE pid='$pid'");
$prow = mysql_fetch_array($getpinfo);
$item = $prow['p_name'];
$distrip = $prow['p_distrip'];
$getqty
//set min qty or set updated qty
if($getqty < 5 ){
$qty = '5';
$qtyctr = $qtyctr + 1;
} else {
$qty = $getqty;
$qtyctr = $qtyctr + 1;
}
$price = $prow['p_altprice'];
$tprice = $qty * $price;
$tprice = money_format('%i',$tprice);
$total_price = $tprice + $total_price;
echo '<tr>
<td class="scartborder"><span class="scitem">' . $item . '</span></td>
<td class="scartborder"><span class="scitem">' . $distrip . '</td>
<td class="scartborder"><span class="scitem">
<input name="' . $qtyctr . '" type="text" id="thisisid" size="5" maxlength="3" value="' . $qty . '"></td>
<td class="scartborder"><span class="scitem">' . $price . '</td>
<td class="scartborder"><span class="scitem">' . $tprice . '</td>
</tr>';
}
when i click update, how can I tell PHP how to automatically look at the form field qty? I think i am really close, i just can't figure it out.
thanks in advance.
chris