$subject = "form results " causing problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx';
      $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

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux