[php] email attachment

I have a form that can send an email attachment. Everything is working (subject , attachment, etc…) except that the main message is empty. What did I do wrong?


// send the message
$att 		= $_FILES['design'];
$att_path 	= $_FILES['design']['tmp_name'];
$att_name 	= $_FILES['design']['name'];
$att_size 	= $_FILES['design']['size'];
$att_type	= $_FILES['design']['type'];

$fp	= fopen($att_path, "rb");
$file = fread($fp, $att_size);
fclose($fp);

$num = md5(time());
$str = "==Multipart_Boundary_x{$num}x";

$file = chunk_split(base64_encode($file));

$hdr = "MIME-Version: 1.0
";
$hdr .= "Content-Type: multipart/mixed; ";
$hdr .= "boundary=\"{$str}\"
";
$hdr .= "From: $from 
";

$msg = "This is a multi-part message in MIME format

";
$msg .= "--{$str}
";
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"
";
$msg .= "Content-Transfer-Encoding: 8bit
";
$msg .= "Name: $name
";
$msg .= "E-mail: $email
";
$msg .= "Title: $title
";
$msg .= "Comment: $comment
";
$msg .= "Agree: $agree

";
$msg .= "--{$str}
";

$msg .= "Content-Type: {$att_type}; ";
$msg .= "name=\"{$att_name}\"
";
$msg .= "Content-Disposition: attachment; ";
$msg .= "filename=\"{$att_name}\"
";
$msg .= "Content-Transfer-Encoding: base64
";
$msg .= "$file

";
$msg .= "--{$str}";

mail($to, "Submission", $msg, $hdr);
echo("<center><p>Submission Sent.</p></center>");