Thanks for the info John, but your suggestion produces the same output. Look
at the source below to see what it produces.

Now is the time for all young men to come to the aid of the party. Now is
the time for all young men to come to the aid of the party.<br />
<br><br />
<br>Testing<br />
<br><br />
<br>Now is the time for all young men to come to the aid of the party. Now
is the time for all young men to come to the aid of the party.<br />
<br><br />
<br>Testing

After 'party' and 'Testing' I hit enter twice, but as you can see above it
adds a 3rd and 4th <br>...

Suggestions?

Thanks


-----Original Message-----
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: July 16, 2004 2:00 AM
To: PHP User
Cc: PHP
Subject: Re: [PHP] Need help with line breaks in a textarea form

PHP User wrote:

> Hi,
> 
> I have been trying to format the textarea output and have come across 
> some code that almost does what I need, but I still have one small
problem.
> 
> Look at the text below that was input into my textarea:
> 
> Now is the time for all young men to come to the aid of the party. Now 
> is the time for all young men to come to the aid of the party.
> Testing
> Now is the time for all young men to come to the aid of the party. Now 
> is the time for all young men to come to the aid of the party.
> Testing.
> 
> When I print this out to my webpage it has a line break before and 
> after the word Testing. I want it to be a wysiwyg - so in the case 
> above there should be no extra line breaks. It should look exactly as
typed.
> 
> The code I tried to change the \n to <BR> are:
> 
> $text2= nl2br ($text);
> or
> $text2 str_replace("\n","<br>",$text);
> 
> This is what I have in my form.
> 
> <textarea rows=10 cols=51 name="text"><textarea>

<textarea rows="10" cols="51" 
name="text"><?=htmlentities($text2)?></textarea>

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to