I won't display string if value of $post['time'] === null or $post['time'] === ''. Look my response https://i.stack.imgur.com/pgFMC.jpg , I won't to show this string 'Um' and 'Uhr' if input type for date not selected(if $post['time'] === null or ''). Look my code. Main of code is this foreach loop. var_dump($message I using only for testing.
$message = '';
$termini = '<p>Terminvorschlagen:</p>';
foreach ($post['date'] as $i => $date) {
if($post['date'] !== NULL || $post['date'] !== '' || $post['time'] !== NULL || $post['time'] !== '') {
$termini .= '<p>' . $i + 1 . '. ' . $date . 'um, ' . $post['time'][$i] . 'Uhr</p>';
}
}
$message .= 'Name: ' . $post['name'] . '<br />';
$message .= 'Phone: ' . $post['phone'] . '<br />';
$message .= 'Email: ' . $post['email'] . '<br />';
$message .= '<br />';
$message .= 'Pneu-Typ: ' . $post['pneu'] . '<br />';
$message .= 'Anzahl Pneus zur Montage: ' . $post['anzahl'] . '<br />';
$message .= 'Marka: ' . $marka . '<br />';
$message .= 'Model: ' . $model . '<br />';
$message .= '<br />';
$message .= $termini;
var_dump($message);
return;