Con il risultato di una query genero una tabella fatta così

Codice PHP:

while($rigaw mysql_fetch_array($sqlw,MYSQL_ASSOC)) {
echo 
"<tr>";

echo 
"<td><input type=hidden name=id[] value=\"$rigaw[ID]\">$rigaw[nome]</td>\n";

echo 
"<td><input type=text name=priorita[] value=\"$rigaw[priorita]\"></td>\n";

echo 
"<td><input type=text name=apparizione[] value=\"$rigaw[apparizione]\"></td>\n";

if(
$rigaw['status'] <> 'F'){
echo 
"<td><input type=\"radio\" name=\"fs[]-$rigaw[ID]\" value=\"S\" checked>S\n";
echo 
"<input type=\"radio\" name=\"fs[]-$rigaw[ID]\" value=\"F\">F</td>\n";
}
else{
echo 
"<td><input type=\"radio\" name=\"fs[]-$rigaw[ID]\" value=\"S\">S\n";
echo 
"<input type=\"radio\" name=\"fs[]-$rigaw[ID]\" value=\"F\" checked>F</td>\n";
}

echo 
"</tr>";

Ho provato ad usare foreach per lanciare un ciclo di query che mi facciano l'update sul db utilizzando come condizione l'uguaglianza del capo ID con $rigaw[ID], ma il ciclo si duplica per ogni variabile.

Come posso fare?