faqts : Computers : Programming : Languages : PHP : Installation and Setup : Operating Systems : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

96 of 198 people (48%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

newline char "\n" does not work within php tags (under IE6/PWS). Any idea why. Help,I am a newbie.

May 10th, 2006 21:10
Dizzee, Gungadin, Mick Saunders, Matt Chatterley, Chris Perry, Pete Davis,


Using <BR> in place of \n works for me
> I'm having the same problem!
I'm not too sure what you're both trying to do, but as IE is mentioned,
I assume you're trying to put a 'newline' into HTML output from PHP - in
which case you need to use the HTML 'br' tag (<br>).
I have the same problem also [newbie]. If you are following the 
tutorial you may have several echoes on new lines terminated with 
semicolons with the php start on the first line and terminator on the 
last line. Those echos have \n in the text. The tutorial states these 
should create a new line for each output. IN IE6 it does not. 
everything is output to the same line as though \n was not used.
eg.
// <?php
// echo "a \n";
// echo "b \n";
// echo "c \n";
// ?>
will print;
abc
instead of;
a
b
c
---
However look at the source code, \n creats a new line in the page source
(as it says it will). If you want to display a newline then you need to
echo <br>