?
Solved

Carriage return and Line feed in PHP

Posted on 2003-10-23
2
Medium Priority
?
10,280 Views
Last Modified: 2010-07-27
I have a website developed in DreamweaverMX using PHP/MySQL.  I am testing it locally on a WindowsXP platform with an Apache webserver.

When I output something from a PHP script to a web page, I can never get carriage return or line feed to work.  I have tried every combination of \n and \r I can think of and searched the PHP manual but cannot figure out what I am doing wrong.

Here's a sample of what I'm doing - within a loop, output each time an e-mail has been sent ($mail_to has been set to an email address pulled from the db):

echo "sent email to - $mail_to\r\n";
flush();

The text and variable data come out correctly but just keep appending to the same line and wrapping.

Thanks in advance.
0
Comment
Question by:eviandell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
errows earned 150 total points
ID: 9612237
If you output to HTML, you need to use <br />...
\n will change line only in the source code...
0
 

Author Comment

by:eviandell
ID: 9612811
Doh! I am such a Watson - you are such a Sherlock!  Thanks heaps!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question