Using arrays to take records from a html table and update database

Using arrays to take records from a html table and update database

am 25.07.2006 23:29:51 von Ian Davies

Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take each row in
turn (and any changes made) and update the mysql table. I did something
similar with just one record but am stuck as to how I use the arrays of a
number of form elements together

My code for the table is below but I dont know how the script should go when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
************************************************************ **********

name="UpdateComments">
bgcolor="#FFFFFF">






while($row =& mysql_fetch_array($commentresults)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "\n";

} else {
$class = 'row2';
echo "\n";
}
$i += 1;
?>




}
?>
Category Comment Share
name="category[]" style="WIDTH: 90%">

$commenttype = mysql_query("SELECT * FROM commenttype WHERE username =
'$username'");
if (!$commenttype) {
exit('

Error performing query: ' . mysql_error() . '

');
}
while($row1 =& mysql_fetch_array($commenttype)) {
extract($row1);
?>

}
?>

name="comm[]" rows="2" style="WIDTH: 99%"> ?> name="avail[]" value="checkbox" >



************************************************************