$fieldNames = [
"lastname",
"name",
"middlename",
"birthday",
"driver-serie",
"driver-number",
"passport-serie",
"passport-number",
"phone-number",
"email",
"lastname1",
"name1",
"middlename1",
"driver-serie1",
"driver-number1",
"passport-serie1",
"passport-number1"
];
$fileds = [];
// всё, добавляйте полей, сколько хотите...
foreach ($fieldNames as $fName) {
$fields[$fname] = htmlspecialchars($_POST[$fname]);
}
$mes = "Сообщение с сайта.\n
Имя отправителя: {$field['lastname']}, {$field['name']}, {$field['middlename']}
Дата рождения: {$field['birthday']}
...
";