RE: [PHP] Updating quantities from Form Fields..need help
| From: | Matthias Endler | Date: | Thu, 26 Oct 2000 03:49:29 +0000 |
| Subject: | RE: [PHP] Updating quantities from Form Fields..need help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22033@lists.php.net to get a copy of this message | ||
Hi Shane,
> A form that has the values being filled in from a database.
> The form shows the contents of a cart
> I want the users to be able to update the quantities.
> I can get the last row item to update, but not the others.
>
> I suspect I need to create an array for the item, and the new
> quantities, than update them in the database.
try this:
<?php
if(!isset($go)) {
$qty[123] = 1;
$qty[DE13] = 1;
}
?>
<html>
<head>
</head>
<body>
<form action="<? echo $PHP_SELF; ?>" method="GET">
<table>
<tr>
<th>ArtNo</th>
<th>Descr</th>
<th>Qty</th>
</tr>
<tr>
<td>123</td>
<td>Red Shoes</td>
<td><input type="text" name="qty[123]" value="<? echo
$qty[123]; ?>"></td>
</tr>
<tr>
<td>DE13</td>
<td>Black Shoes</td>
<td><input type="text" name="qty[DE13]" value="<? echo
$qty[DE13]; ?>"></td>
</tr>
</table>
<input type="submit" name="go" value="Press to modify qty">
</body>
</html>
Cheers,
Matthias