Thanks for the info- I think you have a couple of problems, but they are most likely easily fixed. The first issue appears to me to be in the function gen12select. I would guess that you are not getting todays date preselected in the dropdowns. This is because MM and DD are not doing what you think they are. This will not work:
$date12 = array(date(Y),date(MM), date(DD));
but this should:
$date12 = array(date(Y),date(n), date(j));
The second thing that is a bit confusing to me is the placement of the date12 =sprintf... line. Try putting that right above the query. ie:
$date12 = sprintf("%04d-%02d-%02d", $_POST['year'], $_POST['month'], $_POST['day']);
$query="INSERT INTO dependent (familyname,firstname,relationship,nationality, birthdate,sex,familyname2,firstname2,relationship2,nationality2, birthdate2,sex2,familyname3,firstname3,relationship3,nationality3, birthdate3,sex3)
VALUES('$_POST[ffname]','$_POST[ffirstname2]','$_POST[frelation1]','$_POST[fnationality2]','$date10','$_POST[sex2]','$_POST[ffname1]','$_POST[ffirstname3]','$_POST[frelation2]','$_POST[fnationality3]','$date11','$_POST[sex3]','$_POST[ffname2]','$_POST[ffirstname4]','$_POST[frelation3]','$_POST[fnationality4]','$date12','$_POST[sex4]')";
$result = mysqli_multi_query($cxn,$query) or die ("Couldn't execute query.".mysqli_error($cxn));
print $query;
I believe you are trying to access the $_POST variables for the date before they actually exist.
Hope that helps!