简单的PHP Html表单在提交时遇到错误

时间:2016-05-27 18:54:22

标签: php html forms

我的html表单在提交时抛出错误,我对PHP很新,并想知道我的代码有什么问题..

这是HTML:

<form action="mailer.php" method="POST">

      <input type="text" name="name" placeholder="Navn:">

      <input type="email" name="email" placeholder="Email:">

      <textarea name="message" placeholder="Beskjed:"></textarea>

      <input type="submit" value="Send">

</form>

这是php:

<?php

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent=" From: $name \n Message: $message";
$recipient = "jhermansen@live.no";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";

?>

0 个答案:

没有答案