Could someone tell how to write this insert into a database? The below code is an example of what I am trying to accomplish. I want to have a form for families with multiple children. They submit their family names and one id that they will share in the database. See code below... 

FORM INPUTS

```
<input type="text" name="fname[]"/>
<input type="text" name="lname[]"/>
<input type="text" name="fname[]"/>
<input type="text" name="lname[]"/>
<input type="text" name="family_id"/>

```

This is where I am having troubles. I can submit the family names but only the first(row) "name" is storing the "family\_id" as well. 

PHP

```
        foreach($_POST['fname'] as $key => $fname) {
            $lname = $_POST['lname'][$key];
                            $family_id = $_POST['family_id'][$key];

            $query = mysql_query("INSERT INTO Table (FName, LName, Family_ID ) VALUES ('{$fname}', '{$lname}', $_POST['family_id'])"); 
        } 

```

I appreciate any help!