I want to add this table to e-mail message:
foreach ($songs as $key => $value) {
echo "<tr><td>" . ucfirst($key) . "</td><td>" . $value . "</td></tr>";
}
But something like this won’t work:
$message = '
<html>
<head>
</head>
<body>
<p>Hi, ' . ucfirst($name) . '<br>
</p>
<p>Heres the table</p>
<table class="tables">' .
foreach ($songs as $key => $value) {
echo "<tr><td>" . ucfirst($key) . "</td><td>" . $value . "</td></tr>";
}
. '
</table>
</body>
</html>
';
Thanks in advance! 🙂
The problem is you are echoing instead of appending.