RE: [PHP] mail() problem affecting output to browser on completion

From: Date: Sat, 07 Jun 2003 22:04:23 +0000
Subject: RE: [PHP] mail() problem affecting output to browser on completion
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-150610@lists.php.net to get a copy of this message
> Alright with the following code I am using is printing/echoing to the > browser a "1" before the html output. It's like it's adding 2 variables > together. > > Here is what I am trying to do. I have a form that enters information to a > text file, and at the same time sends the information to a predetermined > email address. This email example is one that I made up on my server, but > will work for this example. I need it to stop printing the number "1" > before > the rest of the page's output. > > $address = "junk@wolf-smart.com"; > $subject = "Your Feedback Page has been submitted\n"; > $body = "The following is the information that was entered.<br>\r\n"; > $body .= "Message Type: $messageType<br>\r\n"; > $body .= "Subject: $subjectbody<br>\r\n"; > $body .= "Other Subject: $otherSubject<br>\r\n"; > $body .= "Comments: $comments<br>\r\n"; > $body .= "User Name: $username<br>\r\n"; > $body .= "Email Address: $email<br>\r\n"; > $body .= "Telephone Number: $telephone<br>\r\n"; > $body .= "Fax Number: $fax<br>\r\n"; > $body .= "Contact Option: $contact<br>\r\n"; > $moreheaders = "From: > Your_Web_Site_Has_Updates@wolf-smart.com\r\nContent-type: text/html\n"; > $send = mail($address, $subject, $body, $moreheaders); > echo $send; Why are you echoing $send? If mail() succeeds, it returns 1 (TRUE), which is assigned to $send, which you then print. The script is doing exactly what you tell it to do. ---John Holmes...

« previous php.general (#150610) next »