1

艰难的一天,我确定我遗漏了一些明显的东西,但是有人可以浏览一下并解释为什么我收到一封空白的电子邮件吗?我已经尽可能地把它分解了,但似乎找不到它空白的原因

<?php
$to = 'blah@blah.com';
$name = $_POST['name'] ;
$subject = "Message from: $name";
$message = $_POST['comment'] ;
$robotest = $_REQUEST['robotest'];
$body = "From: $name \r\nMessage: $message";

/*
if (preg_match($match, $from) ||
preg_match($match, $subject) ||
preg_match($match, $body)) {
die("Header injection detected.");
}
*/

if ($sent == '0') {
mail($to, $subject, $body) or die("Error Bro!!!");
$sent = 1;
}

if ($robotest) {
$error = print("You are a gutless robot.");
}

 if ($name == ' '){
print("You have not entered a name, please go back and try again");
 } else {
$send = mail($to, $subject, $body);
print("Thank you for contacting us. We will be in touch with you very soon.");
 }
 ?>

html:

            <form style="margin-left: 10%;" method="post" action="coming-soon/email.php" enctype="text/plain">
                <br>
                <input id="fName" name="name" type="text"  placeholder="Name (required)"><br><br>
                <p class="robotic" id="pot">
                    <label>If you're human leave this blank:</label>
                    <input name="robotest" type="text" id="robotest" class="robotest" />
                </p>
                <textarea id="fComment" name="comment" style="height: inherit; margin: 0 40% 1% 0;" rows="10" cols="50" placeholder="Place your Message here...."></textarea>
                <input type="submit" value="Send">
                <input type="reset" value="Reset">
            </form>
4

1 回答 1

0

删除它应该可以工作。看看这里method="post" enctype="text/plain" 不兼容?

 enctype="text/plain" 
于 2013-04-09T22:32:16.827 回答