Jump to content

Line breaks not working

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
I'm displaying HTML and linebreaks are not working using "\r\n" or just one of the other.

<HTML><BODY>
text here
<?php print "\r\n"; ?>
more text


There is no line break in the above example.......

#2
Guest_WebScott_*

Guest_WebScott_*
  • Guests
HTML ignores whitespace. You need to use a <BR> tag in your output.

#3
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
Line breaks will not work between HTML statements.
You can use the <PRE> function to enable this

<HTML><BODY>
text here
<pre>
<?php print "\r\n"; ?>
</pre>
more text

using just \r\n will result in a linebreak but not a <BR>. your browser will register this as whitespace and remove it.

#4
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts

WebScott said:

HTML ignores whitespace. You need to use a <BR> tag in your output.

Beat me to the punch line!

#5
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
Oh, stupid me. I wasn't even thinking about that. I haven't even messed with the code since I posted this. I'm going to fix that now.

Thank you for your help all!