编辑:显然我必须付费才能在他们的网站上注册另一个域才能拥有电子邮件功能。很抱歉浪费了时间,并感谢代码修复。
我对php没有任何经验。我才刚刚开始弄清楚。我正在尝试让我的表格将输入的信息发送到我的电子邮件。我设置了一个 else 标签,但这就是发生的一切。如果您发现任何错误,请告诉我。我真的希望这个工作。自己看:网站代码是:
HTML:
<form action="post_comment.php" method="post" id="commentform">
<label for="comment_author" class="required">Your Name</label>
<input name="name" id="name" tabindex="1" required="required"><br/><br/>
<label for="email" class="required">Your Email</label>
<input type="email" id="email" name="email" id="email" value="" tabindex="2" required="required"><br/><br/>
<label for="comment" id="comment" class="required">Your Message</label><br/>
<textarea name="comment" rows="10" tabindex="4" required="required"></textarea><br/>
<input id="submit" name="submit" type="submit" value="Submit Comment" />
<input id="send" name="send" type="hidden" value="1" />
</form>
PHP:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['comment'];
$from = 'From: '. $email;
$to = 'powersjesse@yahoo.com';
$subject = 'WEBSITE';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($_POST['send'] == "1") {
if (mail($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}}
?>
Something went wrong, go back and try again!
当我尝试提交表单时,
我得到了。更新了代码。