【问题标题】:Emails from Form coming in empty?来自表单的电子邮件是空的?
【发布时间】:2013-11-12 00:31:47
【问题描述】:

想知道是否有人可以帮助我发现表单设置中的缺陷?电子邮件正在通过,但邮件发件人没有输入任何信息:

电子邮件正文:

姓名:

电子邮件:

现有客户:

组织类型:

消息:

这是 HTML:

<form action="email.php" method="POST" name="contact" enctype="text/plain">

            <label for="name">Name: </label><input type="text" name="name" id="name">
            <label for="email">Email: </label><input type="text" name="email" id="email"><br><br>

            <label for="existing">Have you written before?</label>
            <input type="radio" name="existing" value="Yes" id="existingyes">Yes
            <input type="radio" name="existing" value="No" id="existingno">No<br><br>

            <label for="orgtype">How do you classify yourself? </label><select id="orgtype">
                <option>Charity</option>
                <option>Business</option>
                <option>Individual</option>
                <option>Meat Popcicle</option>
                <option>Other</option>
            </select><br><br>

            <label for="essay">Thoughts? Questions? Comments</label><br>
            <textarea name="essay" rows="3" cols="70" id="essay">...</textarea><br><br>

            <input type="submit" value="Yell At Us!"><br>

这里是 PHP:

    <?php
  $name    = stripslashes($_POST['name']);
  $email   = stripslashes($_POST['email']);
  $existing   = stripslashes($_POST['existing']);
  $orgtype = stripslashes($_POST['orgtype']);
  $essay = stripslashes($_POST['essay']);
  $form_message = "Name: $name \nEmail: $email \nExisting Customer: $existing \nOrg Type: $orgtype \nMessage: $essay";
  $success = mail("myemail@email.com", "Online Form Submission", $form_message, "From: $email" );
  if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">";

    } else {

echo "Sorry error please try again..."; 

}

?>

任何帮助将不胜感激!

【问题讨论】:

    标签: php html forms email


    【解决方案1】:

    从您的form 标记中删除enctype="text/plain"

    &lt;form action="email.php" method="POST" name="contact"&gt;

    你可以在这里阅读 method="post" enctype="text/plain" are not compatible?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-03
      • 1970-01-01
      • 2016-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多