|
Posted by Tyrone Slothrop on 09/26/28 11:31
On Mon, 07 Nov 2005 00:31:51 -0500, Gand <> wrote:
>$box=$_POST['box1'];
>is an array with the on or off... does it look something like
>$box(
>[0] => 1,
>[1] => 0,
>[2] => 0,
>[3] => 1,
>[4] => 1,
>)
>
>but what does
>$selectID=$_POST['selectID'];
>look like if you print_r($selectID)
>
>because it looks like your passing only one id, thats why it'll update
>(guessing) the last one in the form.
You answered your own question. In order to accomplish this you have
to treat every record as an element of the array. The selectID must
also be treated as an array:
<input type="hidden" name="selectID[]" value="###">
Do a print_r() now and see what happens.
Then the query:
for ($i = 0; $i < count ($_POST['selectID'], $i++) {
mysql_query ("UPDATE pics_selected SET state = '{$_POST['box']}'
WHERE selectID = '{$_POST['selectID']}");
}
Navigation:
[Reply to this message]
|