Newline

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Newline

Postby BGodfrey » 12. August 2004 20:54

OK, I'm a total newbie to php, etc. I'm probably making the most elementary of mistakes, but I sure don't know what it is.

I have the 1.4.5 release of XAMPP (which I understand includes PHP 5) installed on Windows2K Pro - totally stock. I type in the Hello World script and it works. But if I try to use a newline (\n - backslash-n) it is just ignored.

Example:

The output of this:

<?php
echo "This is one line.\nAnd this is another line.";
?>


is:

This is one line. And this is another line.

As you can see, no newline was displayed.

The same is true if I use other escaped characters such as tab. The escaped character is just replaced with a space.

What am I doing wrong?

Thanks,
--Brian M. Godfrey
BGodfrey
 
Posts: 2
Joined: 12. August 2004 20:31
Location: Oregon/California, USA

Postby Wiedmann » 12. August 2004 21:17

"\n" can you only see in text/plain. With text/html it is only shown as newline inside "<pre></pre>" - tags. In HTML you must use the markup <br /> for a newline.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby BGodfrey » 13. August 2004 05:44

Makes perfect sense once I see it.

Thank you!
--Brian M. Godfrey
BGodfrey
 
Posts: 2
Joined: 12. August 2004 20:31
Location: Oregon/California, USA


Return to XAMPP for Windows

Who is online

Users browsing this forum: JJ_Tagy and 67 guests