List:General Discussion« Previous MessageNext Message »
From:Tony Thomas Date:September 29 2003 4:40am
Subject:Re: Text formatting
View as plain text  
That's because the browser doesn't read the line breaks without a <br 
/> tag at the end. All you need to do is this:

<?php

echo nl2br($textarea);

?>

nl4br(); will insert a <br /> tag after every new line so your browser 
can display it correctly.

On Sunday, September 28, 2003, at 11:07  PM, delz wrote:

> Hi All,
>
> I'm using mysql and php but I'm having problems printing my output 
> using a
> browser. It's like this, i have a form and it has a text area that has 
> the
> following contents:
>
> Hello World.
> Hello World.
> Hello World.
>
> What happens is when I output the content using the php command echo,
> i.e.  <?php echo "$textarea";?>
>
> the output is like this on the browser :
>
> Hello World.Hello World. Hello World.
>
> Its printing the output in one straight line.
>
> Are there any command other than "echo" that can output the same 
> format as
> that given on the text area. Please help.
>
> Regards,
>
> Delz	
Thread
Text formattingdelz29 Sep
  • Re: Text formattingTony Thomas29 Sep
    • Re: Text formattingTony Thomas29 Sep
    • Re: Text formattingdelz29 Sep
  • Re: Text formattingDan Nelson29 Sep