我所拥有的是一张已发送的表单,使用的是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>
我遇到的困难是它成功的时候我需要发出$ note但是$ notes总是空白的。我应该把我的sendmail php放在我成功的php里面吗?或者有人可以向我解释为什么$ notes是空白的。
我确实有我的重新密钥,而且我还有一个电子邮件地址。我把一些东西保密了,我的HTML中还有一个音符textarea
这是我对该表的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>
答案 0 :(得分:1)
我建议您使用适用于Firefox的LiveHeaders插件,并准确查看您提交的表单数据,以确保注释字段存在。如果是,则尝试使用var_dump转储$ _POST数组并确保它正确接收。
Eclipse IDE的PHP Development Tools插件有一个非常好的调试器。在调试器中单步调试通常比添加一堆调试代码更容易解决这类问题。