0

嘿伙计们,如果有人可以帮助我,我会喜欢它...

我所拥有的是一个发送的表格,使用了 doublecheck.php

<?php  
    require_once('recaptchalib.php');  
    $privatekey = "";  
    $resp = recaptcha_check_answer ($privatekey,  
    $_SERVER["REMOTE_ADDR"],   
    $_POST["recaptcha_challenge_field"],  
    $_POST["recaptcha_response_field"]);  
    if (!$resp->is_valid) {  
        die ("Sorry please go back and try it again." .  
            "" . $resp->error . ")");  
    }  
    if ($resp->is_valid) {  
        require_once('sendmail.php');  
    }    
?>

然后是我的 sendmail.php

<?php

    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];

    $todayis = date("l, F j, Y, g:i a");

    $attn = $attn ;
    $subject = $attn;

    $notes = stripcslashes($notes);

    $message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($Your Prayer or Concern)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

    $from = "From:\r\n";

    mail("", Prayers and Concerns, $message);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>

<br /><br />
<a href="contact.php"> Next Page </a>
</p>
</body>
</html>

我遇到的困难是当它成功时我需要发送 $notes 但 $notes 总是空白。我应该把我的 sendmail php 放在我成功的 php 中吗?或者有人可以向我解释为什么 $notes 是空白的。

我确实有我的recaptcha 密钥,而且我也有一个电子邮件地址。我将一些东西保密,我的 HTML 中还有一个注释文本区域

这是该表的 html:

<form action="doublecheck.php" action="http://www.ipower.com/scripts/formemail.bml" enctype="application/x-www-form-urlencoded" method="post">
  <table>
    <tbody style="font-size: 12px;">
      <tr>
        <td width="661">Your Prayer or Concern<br/>
          <textarea name="notes" rows="6" cols="100" maxlength="1024"></textarea></td>
      </tr>
      <tr>
        <td><script type="text/javascript" src="http://api.recaptcha.net/challenge?k=6LdoKLoSAAAAAChm6Oaquimz8g1elKd5OQBJtCLm"></script>

<noscript>
    <iframe src="http://api.recaptcha.net/noscript?k=6LdoKLoSAAAAAChm6Oaquimz8g1elKd5OQBJtCLm" height="300" width="500" frameborder="0"></iframe><br/>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>                <p>
              <input type="submit" id="Pray" name="Pray" value="Send your prayer"/>
          </p></td>
      </tr>
      <tr>
      </tr>
    </tbody>

  </table>
</form>
4

1 回答 1

1

我建议您为 Firefox 安装 LiveHeaders 插件,并查看您要提交的表单数据,以确保备注字段存在。如果是,则尝试使用 var_dump 转储 $_POST 数组并确保它被正确接收。

Eclipse IDE的PHP 开发工具插件有一个非常好的调试器。对于这类问题,单步调试通常比添加一堆调试代码更容易。

于 2010-05-30T04:14:03.993 回答