没有按照我应该的方式使用我的 php,感谢您的帮助...
我把它放在html的形式中
<p class="antispam">Leave this empty:
<br /><input name="url" /></p>
这在 css
.antispam { display:none;}
如果 url 字段对于 PHP
来说是空的,那么问题是注释部分?
{curly} 括号对我来说似乎不合适。
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = nl2br($_POST['message']);
$todayis = date("l, F j, Y, g:i a") ;
$subject = "Message from Your Website";
$body = "From $name, \n\n$message";
$headers = 'From: '.$email.'' . "\r\n" .
'Reply-To: '.$email.'' . "\r\n" .
'Content-type: text/html; charset=utf-8' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// if the url field is empty
if(isset($_POST['url']) && $_POST['url'] == ''){
mail("me@my.com", $subject, $body, $headers);
}
?>
<!--My callback -->
<div id="mail_response">
<h3>Thank you <?php echo $name ?>!</h3><br />
<p>I will answer your message soon as possible.</p><br /><br /><br />
<h5>Message sent on: </h5>
<p><?php echo $todayis ?></p>
</div>