Re: Update multiple records from a text field
| From: | Justin Patrin | Date: | Fri, 02 Apr 2004 21:11:37 +0000 |
| Subject: | Re: Update multiple records from a text field | ||
| References: | 1 2 3 4 5 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-23358@lists.php.net to get a copy of this message | ||
Kaizer Boab wrote:
I have changed it to name="qty[]" . How would I reference it on my processing script? "Justin Patrin" <papercrane@reversefold.com> wrote in message news:20040402184037.46651.qmail@pb1.pair.com...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>Kaizer Boab wrote:loop toHi Justin, I only have the one qty field in the View Cart page. It is part of ascriptpull out all the quantities from the cart. It is retrieved via the$row_rsCart['albumArtist'];?></td>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['albumTitle'];?></td><td align="left"><?php echohelp. Is<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'tthere another way I could achieve the update? Thanx for your help.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>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>