Solved

Carriage return and Line feed in PHP

Posted on 2003-10-23
2
10,257 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
2 Comments
 
LVL 2

Accepted Solution

by:
errows earned 50 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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