Page 1 of 1

New line not working...

Posted: Wed Feb 08, 2012 3:01 pm
by orbdrums
This code does not seem to want to display a new line with echo. Any suggestions would be appreciated.

<?php
$to = "To: example@test.net";
$subject = "\nSubject: Test";
$message = "\nMessage: hello";
$headers = "\nFrom: webmaster@example.com" .
"\nReply-To: webmaster@example.com" .
"\nX-Mailer: PHP/" . phpversion();

echo $to, $subject, $message, $headers;

?>

Re: New line not working...

Posted: Wed Feb 08, 2012 3:03 pm
by Celauran
Line breaks don't show in HTML; this is normal. Wrap it in <pre> tags, or use nl2br

Re: New line not working...

Posted: Wed Feb 08, 2012 10:05 pm
by orbdrums
I used the <pre> tags and that worked great. Thanks!