$val){ if (is_array($val)){ $msg.="Item: $key\n"; foreach($val as $v){ $v = stripslashes($v); $msg.=" $v\n"; } } else { $val = stripslashes($val); $msg.="$key: $val\n"; } } $recipient="contactform@domain.com"; $subject="domain.com - Form Submission"; error_reporting(0); if (mail($recipient, $subject, $msg)){ echo nl2br($input); } else echo "An error occurred and the message could not be sent."; } else echo "Bad request method"; ?>