PHP表单从网站发送电子邮件

时间:2013-07-21 22:04:25

标签: php html forms dreamweaver

这是我的html表单,请求反馈。

将相应的PHP表单放在我的网络服务器上以发送电子邮件是什么?我是网站设计的新手,只学过CSS + HTML。

<table width="518" border="0">
          <tr>
            <td width="165"><form name="form1" method="post" action="">
              <label for="nameco">Name/Company</label>
            :
            </form></td>
            <td width="343"><input name="nameco" type="text" id="nameco" size="70"></td>
          </tr>
          <tr>
            <td><form name="form2" method="post" action="">
              <label for="area">Area you are located :</label>
            </form></td>
            <td><input name="area" type="text" id="area" size="70"></td>
          </tr>
          <tr>
            <td><form name="form3" method="post" action="">
              Products interested in :
            </form></td>
            <td><table width="198">
              <tr>
                <td width="190"><label>
                  <input type="radio" name="Product" value="awnings" id="Product_0">
                  Awnings</label></td>
                </tr>
              <tr>
                <td><label>
                  <input type="radio" name="Product" value="carport" id="Product_1">
                  Carport/Shadeport</label></td>
                </tr>
              <tr>
                <td><label>
                  <input type="radio" name="Product" value="patio" id="Product_2">
                  Patio</label></td>
                </tr>
              <tr>
                <td><label>
                  <input type="radio" name="Product" value="other" id="Product_5">
                  Other
                  <input type="text" name="other1" id="other1">
                  </label></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td><form name="form4" method="post" action="">
              <label for="contactno">Contact Number :</label>
            </form></td>
            <td><input name="contactno" type="text" id="contactno" size="70"></td>
          </tr>
          <tr>
            <td><form name="form5" method="post" action="">
              <label for="email">Email Address :</label>
            </form></td>
            <td><input name="email" type="text" id="email" size="70"></td>
          </tr>
          <tr>
            <td><form name="form7" method="post" action="">
              <label for="Comments">Additional Comments :</label>
            </form></td>
            <td><input name="Comments" type="text" id="Comments" size="70"></td>
          </tr>
          <tr>
            <td><form name="form8" method="post" action="">
              <input type="submit" name="Submit" id="Submit" value="Submit">
            </form></td>
            <td><form name="form9" method="post" action="">
              <input type="submit" name="reset" id="reset" value="Reset Form">
            </form></td>
          </tr>
        </table>

这是来自dreamweaver。我如何让表单知道通过这个PHP文件发送?

1 个答案:

答案 0 :(得分:1)

如果我可以给你建议,请不要使用这么多表格,只需使用一个表格并在action中设置send.php

send.php可能如下所示:

<?php
$to = "$_POST['email']";
$subject = "$_POST['subject']";
$message = "$_POST['message']";
$from = "your@email.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>