I'm trying to update one row (= ID) of a mysql table from multiple form fields (text fields and text areas). The table looks like this:

ID | Col 1 | Col 2 | Col 3 ... | Col 50

Everything works fine, if I use $\_Post[] variables like this

```
$Name = $_POST['Name'];
$Name2 = $_POST['Name2'];  
$sql= "UPDATE Bilder SET Name = '$Name', Name2 = '$Name2' WHERE id = '$ID'"; 

<form id="InsertData" action="insert-dataset.php" method="post"> 
  <input type="hidden" name="ID" id="ID" value="'.$row->id.'" /> 
  <input type="text" name="Name" value="'.$row->Name.'" /><br />
  <input type="text" name="Name2" value="'.$row->Name.'" /><br />  
  <input type="submit" name="submit" value="Daten eintragen" class="sendbutton" /> 
</form> 

```

Since I have hundreds of fields I would rather use an array like so:

```
<input type="text" name="Name[]" value="'.$row->Name.'" />

```

I found working examples for updating all cells of one column. But I have to update all colums for one ID. 

Any help would be appreciated. Thanks in advance!

This is the final result:

```
$col_result = mysql_query("SHOW COLUMNS FROM Bilder");
$row_result = mysql_query(sprintf("SELECT * FROM Bilder WHERE id = %s", $ID));
if(!$col_result) {
    echo 'Konnte Anfrage nicht ausführen: ' . mysql_error();
    exit;
}
if ( !empty($_POST) ) { 
    $aDataSet = array(); 
    while( list( $field, $value ) = each( $_POST )) { 
    $aDataSet[] = $field . "='" . $value . "'";
    } 
$update_sql = "UPDATE Bilder SET " . implode( ',', $aDataSet ); 
$update_sql .= sprintf("WHERE id = '$ID'");
$result = mysql_query($update_sql, $connection); 
if(!$result)  
 {  
 die('');  
 }  
 echo '';  
}   
mysql_close($connection)
?> 

```

The update query will only include colums that have corresponding input field (input name = column name). Since I have hundreds of input fields, I can spread them over multiple pages using the same code for the update query.

Thank you all for your help.