I have a loop that enters each non-empty text field into a database:
foreach ($guests as $guest) {
if ($guest !== "") {
mysql_query("INSERT INTO guestlists (guest, night, date) VALUES('$guest', '$night', '$date') ") or die(mysql_error());
}
}
I'd like to also print each of these names into an email, which I presume somehow containing the output within the $message variable in mail(). How is this best achieved?
On a side note, changing from by editing $headers is proving very temperamental. What is the proper way of doing this?