I'm a novice when it comes to PHP. I've been an HTML form that has 6 fields. The 6 fields can be filled in 10 times to account for more people. I'm trying to get the inputs into an array, then print the array so it shows the data for each child. I'm getting an undefined offset error and I'm stuck.
My php is as follows:
if (isset($_POST['submit'])) {
$name = $_POST['Name'];
$gender = $_POST['Gender'];
$month = $_POST['Month'];
$day = $_POST['Day'];
$year = $_POST['Year'];
$rel = $_POST['Relationship'];
}
foreach( $name as $key => $names ) {
$child = "<b>Name</b> - " .$names. ", Gender - " .$gender[$key]. ", Month - " .$month[$key]. ", Day - " .$day[$key]. ", Year - " .$year[$key]. ", Relationship - " .$rel[$key] ."<br>";
}