-1

我的收件箱中只有一部分表单字段返回空白字段

像这样:

From: whatevername
Email: fgsdfg@fakeysite.com 
Message: 
phone:

这是我的代码,它可能真的很愚蠢,但它困扰着我,所以我们开始吧。

HTML

        <div class="row-item col-1_4">
<h3>Contact Form</h3>
<h4>Please fill out the form to get your free CD Replacement Kit</h4>
<!-- Success Message -->
<div class="form-message"></div>
<!-- Form -->
<form class="b-form b-contact-form" action="blast.php">
   <div class="input-wrap m-full-width">
      <i class="icon-user"></i>
      Name
      <input class="field-name" type="text" placeholder="Name (required)">
   </div>
   <div class="input-wrap m-full-width">
      <i class="icon-phone"></i>
      Phone
      <input class="field-phone" type="text" placeholder="Phone">
   </div>
   <div class="input-wrap m-full-width">
      <i class="icon-envelope"></i>
      Email
      <input class="field-email" type="text" placeholder="E-mail (required)">
   </div>
   <div class="input-wrap m-full-width">
      <i class="icon-pencil"></i>
      Message
      <input class="field-comments" type="text"  placeholder="Message">
   </div>
   <input class="btn-submit btn colored" type="submit" value="Send">
</form>

PHP

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$phone = $_POST['phone'];
$formcontent=" From: $name \n Email: $email \n Phone: $phone \n Message: $message";
$recipient = "csmith@legacybrokerage.com";
$subject = "UNLIMITED ANNUITY LEADS CD BLAST";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
4

2 回答 2

3

试试这个,定义name= 'something' 到输入字段

  <input class="field-name" type="text" placeholder="Name (required)" name="name">
  <input class="field-phone" type="text" placeholder="Phone" name="phone">
  <input class="field-email" type="text" placeholder="E-mail (required)" name="email">
于 2013-10-07T21:24:41.320 回答
2

您输入的剂量不是name属性!

<input class="field-name" type="text" placeholder="Name (required)">

正确的 :

<input name="from" class="field-name" type="text" placeholder="Name (required)">
于 2013-10-07T21:26:01.017 回答