$subject = "form results " causing problem

From: Date: Wed, 02 Feb 2005 23:07:48 +0000
Subject: $subject = "form results " causing problem
Groups: php.windows 
Request: Send a blank email to php-windows+get-25512@lists.php.net to get a copy of this message
I was wondering why when I insert the $subject = "form results", I get the ...echo "Message failed to send"; error. But when I comment this out, everything works fine. Please see below. <?php } else { error_reporting(0); // initialize a array to //hold any errors we encounter $errors = array(); // test to see if the form was actually // posted from our form // In testing, if you get an Inavlid referer error // comment out or remove the next three lines $page = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; if (!ereg($page, $_SERVER['HTTP_REFERER'])) $errors[] = "Invalid referer"; // check to see if a name was entered if (!$_POST['from']) $errors[] = "Name is required"; // check to see if email was entered if (!$_POST['email']) $errors[] = "a valid e-mail address is required"; // if there are any errors, display them if (count($errors)>0) { foreach($errors as $err) echo "$err<br>\n"; echo "<br>Please use your browser's Back button to fix."; } else { // no errors, so we build our message $subject = "form results"; $recipient = 'fojomo@yahoo.com'; $phone = stripslashes($_POST['phone']); $from = stripslashes($_POST['from']); $mail = stripslashes($_POST['email']); $comments = "Comments from: $from\n\n".stripslashes($_POST['comments']); if (mail($recipient, $comments, $phone, $mail, $subject)){ echo nl2br("<b>Thank you! Information Sent:</b> To: $recipient name: $from email: $mail phone: $phone content: $comments"); } else echo "Message failed to send"; } } ?> ===== ---------------- "forget your lust for the rich man's gold. All that you need, is in your soul. You can do this if you try. All that I want for you my son, is to be satisfied" ~ Lynard Skynard

« previous php.windows (#25512) next »