您必须原谅我,我是自学 PHP 并且对所有这些都是新手,但我正在尝试创建一个简单的 PHP 电子邮件提交表单,并且无法在收到的电子邮件中填写电子邮件或公司字段。我知道我在看它很容易,但我无法弄清楚。另外,我需要找到一种方法将发件人的电子邮件放在发件人区域,而不是我得到的通用 d91b8401@p3nlhg1156.shr.prod.phx3.secureserver.net。任何帮助将不胜感激。
<?php $name = $_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
$message = $_POST['message'];
$formcontent="From: $name \nEmail: $email \nCompany: $company \nMessage: $message";
$recipient = "sales@pinnaclewebsitedesigns.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
这是html
<form method="POST" action="send.php" class="contactForm">
<div id="status"></div>
<div class="contact_form">
<div class="row">
<div class="small-4 columns">
<input type="text" placeholder="Name" id="name" name="name" />
</div>
<div class="small-4 columns">
<input type="text" placeholder="E-mail" id="email" />
</div>
<div class="small-4 columns">
<input type="text" placeholder="Company" id="company" />
</div>
<div class="small-12 columns">
<textarea cols="10" rows="15" id="message" name="message"></textarea>
</div>
<div class="small-4 columns">
<input type="submit" class="button success right" value="Send message" name="send" id="send" />
</div>
</div>
</div>
</form>