Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Carriage return and Line feed in PHP

Posted on 2003-10-23
2
Medium Priority
?
10,290 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …
Suggested Courses

609 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