dongzhukuai8177 2015-04-10 04:59
浏览 80
已采纳

为什么我的文本字段中的值不会出现在按下提交时发送的电子邮件中?

Love the site, this is my first question here.. I'm new to programming php..I have the following coding on my default page where the Form is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mill City Cannabis</title>
</head>

<body bgcolor="#000000">
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="25">&nbsp;</td>
  </tr>
  <tr>
    <td>
        <center>
          <img src="Images/mccBanner.jpg" width="900" height="320" alt="Mill City Cannabis" />
        </center>
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
      <table width="1000">
        <tr>
          <td width="400">&nbsp;</td>
          <td>
            <form action="thankyou.php" name="feedback">
            <label>
              <font face="Tahoma" color="#00FF00" size="2">Name:</font>
            </label><br />
            <input type="text" name="name" style="font-size:10px font:Tahoma border-color:#0F0" required="required" /><br />
            <label>
              <font face="Tahoma" color="#00FF00" size="2">Email:</font>
            </label><br />
            <input type="email" name="email" required="required" /><br /><br />
            <label>
              <font face="Tahoma" color="#00FF00" size="2">What would you like to see as content here @ Mill City Cannabis:</font><br />
            </label>
            <textarea name="content" required="required"></textarea><br />
            <br />
            <input type="submit" name="submit" id="submit" value="Submit" />
            <input type="reset" name="reset" id="reset" value="Reset" />
            </form>
          </td>
          <td width="400">&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>

and when it renders to the "thankyou.php" page this is what's inside my "thankyou.php" page:

<?php

##############################
#                            #
# Coded By: Joshua Martinez  #
# MrJoshuaMartinez@gmail.com #
#                            #
##############################

/* Subject and Email variables */

$emailsubect = "Feedback";
$webMaster = "millcitycannabis@gmail.com";

/* Gathering Data Variables */

$namefield = $_POST['name'];
$emailfield = $_POST['email'];
$contentfield = $_POST['content'];

$body = <<<EOD
<br><hr><br>
Name: $namefield <br>
Email: $emailfield <br>
Feedback: $contentfield <br>
EOD;

$headers = "From: $email
";
$headers .= "Content-type: text/html
";
$success = mail($webMaster, $emailsubect, $body, $headers);

/* Results rendered as HTML */

$theResults = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mill City Cannabis</title>
</head>

<body bgcolor="#000000">
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="25">&nbsp;</td>
  </tr>
  <tr>
    <td>
    <center>
      <img src="Images/mccBanner.jpg" width="900" height="320" alt="Mill City Cannabis" />
    </center>
    </td>
  </tr>
  <tr>
    <td height="50">&nbsp;</td>
  </tr>
  <tr>
    <td align="center">
<font face="tahoma" size="2" color="#00FF00">
      Thank You For Your Feed Back!<br />
      Please check back soon with us!
    </font>
    </td>
  </tr>
  <tr>
<td align="center">
      <font face="tahoma" size="1" color="#00FF00">© All Rights Reserved</font> 
      <font face="tahoma" size="1" color="#FFFFFF">Mill City Cannabis </font>
      <font face="tahoma" size="1" color="#00ff00">2015</font>
</table>
</body>
</html>
EOD;
echo "$theResults";
?>

and finally when the email is sent, all that appears is:

Blank unknownk sender

Name: (blank)
Email: (blank)
Feedback: (blank)

  • 写回答

2条回答 默认 最新

  • dtxw20878 2015-04-10 05:02
    关注
    <form action="thankyou.php" name="feedback">
    

    do mention method type here

    <form action="thankyou.php" name="feedback" method="post">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog