while loop question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I am processing a form submission using POST method. Since some of the
fields are going to be blank and I want to eliminate getting those in
the email sent to me, I have put this code together that seems to work
okay and not throw any errors:

error_reporting (E_ALL);
while(list($key, $val) = each($_POST)){
     foreach($val as $element)
       $mesg .= "$key: $element\n";
   if($val == "") {
     $mesg .= "$key: $val\n\n";

    $to      = 'foo@foo.com';
    $subject = 'Info Submission';
    $header    = "From: $_POST[email]\r\n";
    mail(    $to,

But what puzzles me is that when I echo the results of $mesg to the
page, it's fine. But when it sends to me in an email, I get an extra
period (.) about five or six lines down on every submission and I can't
find out why.

I know it's not exactly an earth-shaking problem but I'm curious as to
what I may have done wrong so I can correct it and make sure I don't
repeat it in the future.

Thanks for any help.

Site Timeline