Get all POST data and send in email

$message = "";
foreach ($_POST as $key => $value)
$message .= "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";

mail('[email protected]', 'sghting', $message);

foreach ($_POST as $key => $value)
    $message .= "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";

mail('[email protected]', 'sghting', $message);

$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.

Tags:

Mysql

Php

Email