John Bokma wrote:
[color=blue]
> Chris Hope wrote:
>[color=green]
>> Michael Bradley-Robbins wrote:
>>[color=darkred]
>>> I am writing a program, and I am using \n in double-quoted print
>>> statements, which should give me a line break. It doesn't work. I'm
>>> running Apache 2.0 and PHP 5, with Mozilla Firefox as a browser.
>>> What is wrong?[/color]
>>
>> This one needs to go in the FAQ list.[/color]
>
> of an HTML group? I am sure it is. :-D.[/color]
Heh - yes it's basic fundamental HTML skills we're talking about here.
Although I've seen this same question asked here a few times now...
[color=blue][color=green]
>> \n gives you a newline break in the data sent to the browser, so if
>> you select the view source option in your browser you'll see the
>> source does indeed have a linebreak where you are expecting it.
>> However, linebreaks are ignored in HTML. To create a line break in
>> HTML which is rendered in the browser, you need the <br> tag.[/color]
>
> Depends on what you want, it could be that you don't *want* the br
> element.[/color]
Very true. I was making an assumption based on the same experience other
people have had when posting here about this problem. Plus it seems
very unlikely that print "\n" does not output a newline break ;)
--
Chris Hope - The Electric Toolbox -
http://www.electrictoolbox.com/