-4
        <?php
        date_default_timezone_set('America/New_York');

          $to = "ry@cbpar.com"; 
          $subject = "New Membership Sign Up"; 
          $message = "First Name:" $_POST['one'];
                     "Last Name:" $_POST['two'];
                     "Email:" $_POST['three'];
                     "Password:" $_POST['four'];
                     "Phone:" $_POST['five'];
                     "Address 1:" $_POST['six'];
                     "Address 2:" $_POST['seven'];
                     "Pick Up City:" $_POST['eight'];
                     "State:" $_POST['nine'];


          mail($to, $subject, $message);
        ?>

谁能告诉我这段代码有什么问题?表格似乎没有发送,按照它应该的方式标记了所有内容,但不确定为什么它不起作用

这是表格,

    <table width="551" border="0" cellspacing="0" cellpadding="3">
          <form method="post" action="send.php">
              <tr>
                <td width="108" class="TextAB"><div align="right"><strong>First Name:</strong></div></td>
                <td width="431"><label>
                  <div align="left">
                    <input name="one" type="text" id="001" size="50"/>
                    </div>
                </label></td>
              </tr>
              <tr>
                <td><div align="right"><span class="TextAB"><strong>Last Name:</strong></span></div></td>
                <td><div align="left">
                  <input name="two" type="text" id="002"  size="50" />
                </div></td>
              </tr>
              <tr>
                <td><div align="right"><span class="TextAB"><strong>Email:</strong></span></div></td>
                <td><div align="left">
                  <input name="three" type="text" id="textfield3"  size="50" />
                </div></td>
              </tr>
              <tr>
                <td><div align="right"><span class="TextAB"><strong>Password:</strong></span></div></td>
                <td><div align="left">
                  <input name="four" type="text" id="textfield4"  size="50" />
                </div></td>
              </tr>
              <tr>
                <td><div align="right"><span class="TextAB"><strong>Phone:</strong></span></div></td>
                <td><div align="left">
                  <input name="five" type="text" id="textfield5"  size="30" />
                </div></td>
              </tr>
              <tr>
                <td valign="top"><div align="right"><span class="TextAB"><strong>Address 1:</strong></span></div></td>
                <td><div align="left">
                  <textarea name="six" cols="50" rows="3" wrap="virtual" id="textfield6"></textarea>
                  <br />
                  <span class="TextA style1">Please fill out full address, building number, street, city,state &amp; zip</span></div></td>
              </tr>
              <tr>
                <td><div align="right"><span class="TextAB"><strong>Address 2:</strong></span></div></td>
                <td><div align="left">
                  <input name="seven" type="text" id="textfield7"  size="50" />
                </div></td>
              </tr>
              <tr>
                <td><div align="right"><span class="TextAB"><strong>Pick-Up City:</strong></span></div></td>
                <td><div align="left">
                  <select name="eight" id="select">
                    <option value="Malabar">Malabar</option>
                    <option value="Ocala">Ocala</option>
                    <option value="Orlando">Orlando</option>
                    <option value="Orlando - Charles Schwab">Orlando - Charles Schwab</option>
                    <option value="West Palm Beach">West Palm Beach</option>
                  </select>
                </div></td>
              </tr>
              <tr>
                <td><div align="right"><span class="TextAB"><strong>State:</strong></span></div></td>
                <td><div align="left">
                  <select name="nine" id="select2">
                    <option value="Florida">Florida</option>
                  </select>
                </div></td>
              </tr>
              <tr>
                <td><div align="left"></div></td>
                <td><div align="left"></div></td>
              </tr>
              <tr>
                <td><div align="left"></div></td>
                <td><label>
                  <div align="left"><a href="#" class="TextE" onclick="javascript:Terms();document.getElementById('ch1').disabled=false;document.getElementById('ch2').disabled=false;"/><span class="TextE"><strong>Click to read MEMBER AGREEMENT<br />
                          <br />
                    </strong></span></a>
                    <input type="checkbox" id="ch1" name="ch1" value="" disabled/>
                    <span class="TextE"><strong>I have read the Terms of Agreement</strong></span></div>
                </label></td>
              </tr>
            </table>
            </td>
            <td width="129" valign="bottom"><INPUT TYPE="image" name="ch2" id="ch2" value="" SRC="images/submitbutton.jpg" WIDTH="111"  HEIGHT="136" BORDER="0" ALT="SUBMIT" disabled></td>
          </tr>
        </table></td>
      </tr>
    </table> </form></td></tr>

任何帮助,将不胜感激

为什么当我尝试提交时它不会进入我的电子邮件?

我确实将它设置为提交时它会转到另一个页面,在那里他们为会员付费,但我希望表格中的信息能发给我自己,这样我就可以看到谁加入了该网站。

4

2 回答 2

8
      $message = "First Name:" $_POST['one'];
                 "Last Name:" $_POST['two'];
                 "Email:" $_POST['three'];
                 "Password:" $_POST['four'];
                 "Phone:" $_POST['five'];
                 "Address 1:" $_POST['six'];
                 "Address 2:" $_POST['seven'];
                 "Pick Up City:" $_POST['eight'];
                 "State:" $_POST['nine'];

应该:

      $message = "First Name:" . $_POST['one'] . "\n" .
                 "Last Name:" . $_POST['two'] . "\n" .
                 "Email:" . $_POST['three'] . "\n" .
                 "Password:" . $_POST['four'] . "\n" .
                 "Phone:" . $_POST['five'] . "\n" .
                 "Address 1:" . $_POST['six'] . "\n" .
                 "Address 2:" . $_POST['seven'] . "\n" .
                 "Pick Up City:" . $_POST['eight'] . "\n" .
                 "State:" . $_POST['nine'];

你不是从 PHP 中得到解析错误吗?您的代码甚至不接近有效语法。使用 连接字符串.,而不仅仅是将它们彼此相邻。;每行之间都有一个,这结束了分配。其余行不是任何类型的有效 PHP 语句。

您需要熟悉基本的 PHP 编码。

于 2013-08-16T05:30:03.460 回答
0

使用以下

<?php
    date_default_timezone_set('America/New_York');

      $to = "ry@cbpar.com"; 
      $subject = "New Membership Sign Up"; 
      $message = "First Name:".$_POST['one'];
      $message.=  "Last Name:". $_POST['two'];
      $message.=  "Email:". $_POST['three'];
      $message.=  "Password:". $_POST['four'];
      $message.=  "Phone:" .$_POST['five'];
      $message.=  "Address 1:" .$_POST['six'];
      $message.=  "Address 2:" .$_POST['seven'];
      $message.=  "Pick Up City:" .$_POST['eight'];
      $message.= "State:" .$_POST['nine'];

你的邮件功能也有问题。并且您没有使用$header。使用如下邮件功能:-

      $headers = 'From: webmaster@example.com' . "\r\n" .
                 'Reply-To: webmaster@example.com' . "\r\n" .
                 'X-Mailer: PHP/' . phpversion();

         mail($to, $subject, $message, $headers);
    ?>
于 2013-08-16T05:41:47.187 回答