简单的PHP Contactform问题

时间:2017-03-04 12:15:17

标签: php html

所以我在HTML网站上的PHP Contactform有一些问题。

以下代码是我用HTML编写的。 (那不是问题)

<form action="sendmail.php" method="POST" class="contact-form">
<input type="text" placeholder="Amount" name="amount">
<input type="text" placeholder="Name" required name="name">
<input type="text" placeholder="Email Address" required name="email">
<div class="validation">
    <button class="btn" name="submit">Send request</button>

//结束HTML代码。 (下面是启动PHP)。

$email_to = "domain@website.com";
$amount = $_POST["amount"];
$name = $_POST["name"];
$email = $_POST["email"];
$email_subject = "DOMAINNAME";
$headers = "From: " . $email . "\n";
$headers .= "Reply-To: " . $email . "\n";
$message = 'Name: ' . $name . ', email: ' . $email . ', amount: ' . $amount;

ini_set("sendmail", $email);
if (!filter_var($email, FILTER_VALIDATE_EMAIL) === false) 
{$sent = mail($email_to, $email_subject, $message, $headers, "-f" .$email);}

{
    header("Location:https://website.com");
} else {
    echo "There has been an error sending your comments. Please try later.";
}

我错了什么?我只想收到 - &gt;姓名,金额和邮件。 只有当我在我的HTML网站上按提交时,它才会将我发送到website.com/sendmail.php(HTTP ERROR 500)。

谢谢你们。

0 个答案:

没有答案
相关问题