この答え全体を書き直しましょう。
HTMLフォーム: [index.html]:
<html>
<body>
<form action="php_file.php" method="post">
<input type="text" name="field_1"/>
<input type="text" name="something_else"/>
<input type="text" name="third_field"/>
<input type="submit" name="submit" value="send!"/>
</form>
</body>
</html>
PHP ファイル (プロセッサ): [php_file.php:]
$email_body = '';
foreach($_POST as $key => $value)
{
$email_body .= "Field name: ".$key . "Value: ".$value."<br />";
}
//send email with $email_body as the email body!
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "website@stacksomething.com";
$headers = "From:" . $from;
mail($to,$subject,$email_body ,$headers);
echo "Email was sent!";