Im literally going crazy. :hair: Really. I have hours trying to do this but I cant!!! :hair:
Here is the thing. A result from a MySQL query is:
ID | SELECTED ITEM | QUANTITY
81 | A2, E3, F8 | 1, 2, 1
Now the thing is that I have an UPDATE button that its supposed to update the quantity. So I need a loop that will get me the something like:
$updatedQuantity = 1, 2, 3
That is, all the quantities, including the one I updated. Im totally lost here. Please heeeelp. Thanks in advance,
Leo
for ($i=0; $i<count($splitproductName); $i++)
{
echo("<TR><TD class='customerCell'>" . $splitproductidCode[$i] . "</TD>");
echo("<TD class='customerCell'>" . $splitproductName[$i] . "</TD>");
echo("<TD class='customerCell'>" . $splitprice[$i] . "</TD>");
echo("<TD class='customerCell'><input name='" . $splitproductidCode[$i] . "' type='text' id='" . $splitproductidCode[$i] . "' size='3' maxlength='3' value='" . $splitquantity[$i] . "'></TD>");
echo("<TD class='customerCell'><a href='removeConfirmation.php?productidCode=" . $splitproductidCode[$i] . "&sessionid=" . $sessionid . "&completeName=" . $completeName . "&customerid=" . $customerid . "&productidCodeALL=" . $productidCodeALL . "'>[ REMOVE ]</a></TD></TR>");
for($c=0; $c<count($splitproductName);$c++)
{
$newQuantity = $newQuantity . ", " . $splitquantity[$c];
}
$counter = 0;
while($counter < $c )
{
$quantityNEW = $splitquantity[$counter] . ", ";
$counter++;
}
echo "new: " . $quantityNEW;
}
echo ("</TABLE>");
echo ("<p>" . $c);
THIS IS SOME HTML FROM THE FORM.
<BLOCKQUOTE><FORM name="updateForm" action="/invoice/showCart.php?completeName=Elvia R Zapata&customerid=3" method="post">
<TABLE border="1" cellpadding="0" cellspacing="0" class="formTable">
<TR><TD class="customerCell"><B>Product ID</B></TD><TD class="customerCell"><B>Product Name</B></TD>
<TD class="customerCell"><B>Price</B></TD><TD class="customerCell"><B>Quantity</B></TD><TD class="customerCell"><B>Action</B></TD></TR>
<TR><TD class='customerCell'>g45</TD><TD class='customerCell'>Don Quijote statue</TD><TD class='customerCell'>78.99</TD><TD class='customerCell'><input name='g45' type='text' id='g45' size='3' maxlength='3' value='1'></TD><TD class='customerCell'><a href='removeConfirmation.php?productidCode=g45&sessionid=2a60f5045b21923c905b3c69ee6379f6&completeName=Elvia R Zapata&customerid=3&productidCodeALL=g45, LDR01, TYU'>[ REMOVE ]</a></TD></TR>new: 1, <TR><TD class='customerCell'>LDR01</TD><TD class='customerCell'>Wooden Ladder</TD><TD class='customerCell'>35.99</TD><TD class='customerCell'><input name='LDR01' type='text' id='LDR01' size='3' maxlength='3' value='1'></TD><TD class='customerCell'><a href='removeConfirmation.php?productidCode=LDR01&sessionid=2a60f5045b21923c905b3c69ee6379f6&completeName=Elvia R Zapata&customerid=3&productidCodeALL=g45, LDR01, TYU'>[ REMOVE ]</a></TD></TR>new: 1, <TR><TD class='customerCell'>TYU</TD><TD class='customerCell'>Aztec Plate</TD><TD class='customerCell'>7.99</TD><TD class='customerCell'><input name='TYU' type='text' id='TYU' size='3' maxlength='3' value='1'></TD><TD class='customerCell'><a href='removeConfirmation.php?productidCode=TYU&sessionid=2a60f5045b21923c905b3c69ee6379f6&completeName=Elvia R Zapata&customerid=3&productidCodeALL=g45, LDR01, TYU'>[ REMOVE ]</a></TD></TR>new: 1, </TABLE><p>3</TABLE><input name="updateButton" type="submit" id="updateButton" value="Update Quantity">
</FORM></BLOCKQUOTE>