You are here: Re: Updating mutliple records from one form « All PHP « IT news, forums, messages
Re: Updating mutliple records from one form

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация