Re: Dynamic Form List - how to change values
| From: | Pat | Date: | Thu, 02 Mar 2006 03:36:49 +0000 |
| Subject: | Re: Dynamic Form List - how to change values | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231315@lists.php.net to get a copy of this message | ||
Thanks to all who helped.
The answer...drumroll.... arrays for each entry:
load routine (partial):
print "<td align='center' valign='top'><input type='text' name='imageqty[]' size='5' value='$qty'></td>";
print "<input type='hidden' name='hiddenalbum[]' value='".$row[cialbum]."'>";
print "<input type='hidden' name='hiddenset[]' value='".$row[ciset]."'>";
print "<input type='hidden' name='hiddenimage[]' value='".$row[ciimage]."'>";
print "<input type='hidden' name='hiddensize[]' value='".$row[cisize]."'>";
retrieval routine (partial):
$cartid = $_COOKIE['PHPSESSID'];
$imageqty = $_POST['imageqty'];
$qty = $_POST["imageqty"];
$album = $_POST["hiddenalbum"];
$set = $_POST["hiddenset"];
$image = $_POST["hiddenimage"];
$size = $_POST["hiddensize"];
$n = count($qty);
$index = 0;
while($index < $n)
{
$newqty = $qty[$index];
$queryupdate = "update CartItems set ciqty = '$newqty' where ciid = '$cartid' and cialbum = '$album[$index]' and ciset = '$set[$index]' and ciimage = '$image[$index]' and cisize = '$size[$index]'";
querythedatabase($queryupdate); // my routine$index++; }