TedT Posted June 14, 2008 Share Posted June 14, 2008 Hi, I am not a PHP programmer, but have been trying to get a contact form to work on my website. The PHP script for sending the form is from a public site. It gets user input and emails it. The problem is sometimes the email has the user input on seprate lines, and sometimes 2 or more lines are run together making it hard to read. The code has a period at the end of each line (and I can't find any PHP info to say why). Here is the the email code: $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "Company Name: $company\n" . "Phone: $phone\n" . "Email of sender: $email\n" . "Email confirmation: $emailconfirm\n" . "Heard of us through: $through\n" . "Add to mailing list: $mailinglist\n" . "Is this a technical problem: $techproblem\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, Are the periods a mistake an causng problems? Sometime 3 lines are all run together in the email, sometimes it is OK. Thanks for any help. Ted Link to comment https://forums.phpfreaks.com/topic/110217-missing-new-lines-sometimes/ Share on other sites More sharing options...
hansford Posted June 14, 2008 Share Posted June 14, 2008 the periods(.) are whats holding the string together. Try replaceing the \n with <br> if displaying in html pages. Link to comment https://forums.phpfreaks.com/topic/110217-missing-new-lines-sometimes/#findComment-565559 Share on other sites More sharing options...
tapos Posted June 14, 2008 Share Posted June 14, 2008 try replacing \n with <br />, but when u need to send a html mail. a suggession for u, try to use PHPMailer to send mail http://phpmailer.codeworxtech.com/ Link to comment https://forums.phpfreaks.com/topic/110217-missing-new-lines-sometimes/#findComment-565592 Share on other sites More sharing options...
hansford Posted June 14, 2008 Share Posted June 14, 2008 Perfect - phpmailer is great and easy. Link to comment https://forums.phpfreaks.com/topic/110217-missing-new-lines-sometimes/#findComment-565596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.