I'm using a cms and i'm trying to create a snippet that updates a mysql table from an html form array.
This is my form which creates a few input tags and works fine:
while ($data1 = mysql_fetch_array($result1)) {
$productgroup_id = $data1["productgroup_id"];
$productgroup_name = $data1["productgroup_name"];
$list = $data1["list"];
echo '
<tr>
<td class="fieldlabel" width="30%">'.$productgroup_name.' Group</td>
<td class="fieldarea"><input type="text" name="list[]" size="30" value="'.$list.'"> List ID</td>
</tr>
';
}
This is my code to update the database which does not work:
if(isset($_POST['submit'])) {
$list = $_POST['list'];
foreach($list as $value){
$update = array(
$list[] = $value,
);
update_query("mod_lists", $update, "");
}