Im trying to use PHP Mail function to send myself an email of all post variables.
So far I have this…
$message = foreach ($_POST as $key => $value)
echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
$message = wordwrap($message, 70);
mail('liam@site.co.uk', 'sghting', $message);
Only the message being submitted is my last post record, can anybody see where im going wrong?
$message = foreach ($_POST as $key => $value)is not correct, this will iterate over the results and store the last one. You want to store the values in your $message variable, not echo them.