1

rough day and I'm sure I'm missing something obvious, but could someone glance over this and explain why I'm getting a blank email? I've broken this down as much as possible but can't seem to find the reason why its blank

<?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>
atlMapper
  • 764
  • 3
  • 9
  • 24
  • What type of server is this on? some boxes don't have sendmail capabilities, or require you to make some changes to the http.conf file (like an email server, admin email address etc.) Also, did you check your junkmail folder? – Syndrose Apr 09 '13 at 22:22
  • At quick glance everything looks ok. Are you sure those variables actually have something stored in them? – Haru Apr 09 '13 at 22:24
  • What's the point of the `if($sent == '0')`? – Mike Apr 09 '13 at 22:26
  • @Syndrose the email is sending, but the fields are returning blank in the email. – atlMapper Apr 09 '13 at 22:26
  • @350_Design The variables are supposed to be pulling from the html page and I'm typing in them but it seems to not be pulling from the fields – atlMapper Apr 09 '13 at 22:26

1 Answers1

0

Remove and it should work. Have a look here as well method="post" enctype="text/plain" are not compatible?

 enctype="text/plain" 
Community
  • 1
  • 1
Haru
  • 1,361
  • 2
  • 15
  • 40