The quickest solution may be to have each of those foreach()
loops also write to your $corpo_mensagem
, something like
$corpo_mensagem = "
ENCOMENDA
";
foreach ($_POST['produto'] as $item){
echo 'Produto:' . $item . '<br>';
$corpo_mesagem .= "Produto: $item\n";
}
// same idea for each of the other 3 foreach()'s
// Then later on:
$corpo_mensagem .= "
OBSERVAÇÕES
Mensagem: $mensagem_form
";
However, if things are not organized the way you want, it may make more sense to use those foreach()
loops to populate some sort of mutli-dimension array, which you could then iterate through as needed to output your HTML and to populate the email text?