I'm having trouble with an array. It actually appears on a page: a form of several lines. Each line corresponds to a record in the database and so they all have a common denominator.

More thanks to javascript I can add fields on the fly.

The trouble I'm having is when recording data. In fact I thought at first I should `delete` everything, and then `insert` so I just the following query:

```
<?php if(isset($_POST['enreg']))
{

foreach($_POST['data'] as $data){
    if (!empty($data['code_s'])){
$sql2="DELETE FROM scenarii WHERE code_s='".mysql_real_escape_string($_GET['code_s'])."'";
mysql_query($sql2) or die(__LINE__.mysql_error().$sql2);    

$sql7 = '
INSERT INTO  scenarii SET 
code_s              = "'.mysql_real_escape_string($data['code_s']).'", 
titre               = "'.mysql_real_escape_string($data['titre']).'",
action              = "'.mysql_real_escape_string($data['action']).'", 
libelle             = "'.mysql_real_escape_string($data['libelle']).'",
jour                = "'.mysql_real_escape_string($data['jour']).'"' ;    
mysql_query($sql7) or die(__LINE__.mysql_error().$sql7);

    } 
  } 
}
?>

```

The worries is that the deleted information is not stored again (though they are in the post variable as they exist in the form of a form and are therefore the variables.

In fact it only saves the new rows from javascript.

The trouble is that I can not do an update just because there are new lines.