I have changed it to name="qty[]" . How would I reference it on my processing script?
"Justin Patrin" <papercrane@xxxxxxxxxxxxxxx> wrote in message news:20040402184037.46651.qmail@xxxxxxxxxxxxxxx
Kaizer Boab wrote:
Hi Justin,
I only have the one qty field in the View Cart page. It is part of a
loop to
pull out all the quantities from the cart. It is retrieved via the
script
below:
<?php // Query the cart table and select all the items from the table. $resultCart = mysql_query("SELECT * FROM cart, products WHERE cart.albumId = products.albumId AND cart.trackerId = $trackerId ORDER by products.albumTitle ASC"); while($row_rsCart = mysql_fetch_array($resultCart)) { $cost = $row_rsCart['albumPrice'] * $row_rsCart['qty']; $cost = number_format ($cost, 2); $subTotal = number_format ($subTotal, 2); $subTotal += $cost; ?> <tr> <td align="left"><?php echo
$row_rsCart['albumArtist'];?></td>
<td align="left"><?php echo
$row_rsCart['albumTitle'];?></td>
<td align="right"><?php echo $cost;?></td> <td align="right <input name="qty" type="text" size="2" value="<?php echo $row_rsCart['qty'];?>" /> </td> </tr> <?php }// END while loop;?>
Since the qty text field is only one box in a loop, naming it won't
help. Is
there another way I could achieve the update?
Thanx for your help.
Looks like you're naming all of your quantity text boxes "qty". You need to use different var names to make multuple values come back. For instance you could use "qty[]" to have the results come back in an array. Or you could use qty[x] where x is a specific # so that you know which product to update.
-- paperCrane <Justin Patrin>
You need to use what I said in my reply. Change name="qty" to name="qty[]" or name="qty[some database id]".
-- paperCrane <Justin Patrin>
Just try a print_r to see how it comes out and work from there. ;-)
You'll have an array of values.
-- paperCrane <Justin Patrin>
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php