Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to echo a cariage return in TextArea box

Status
Not open for further replies.

ljCharlie

IS-IT--Management
Joined
Apr 21, 2003
Messages
397
Location
US
Is there a way to put a carieage return in textarea? In PHP, I want to echo a cariage return in a TextArea box. Any help is appreciated!

ljCharlie
 
use \r\n

--
How can you be in two places at once when you're not anywhere at all?
 
Also check out the PHP function print nl2br


If this function does not help, the alternatives mentioned in the user comments at the bottom of that web page should.

- - picklefish - -

Why is everyone in this forum responding to me as picklefish?
 
Thank you everyone for helping me out. It's working. The \n has worked wonderfully.

Again, thanks!

ljCharlie
 
the best way is nl2br function it will put them in as you typed them in.

print nl2br($nameosyourtable or $field);

that will do the trick
this way it interprets php's nl to html's <br>

Hope this helps
Max

Nothing is hard when you realy want to learn it.

Max
 
nl2br() will not do what he's asking. He's not trying to put br's in. He wants to put line breaks into plain text in a textbox, not in HTML.

--
How can you be in two places at once when you're not anywhere at all?
 
you should look again cause it does put new lines in a text box.. I do it all the time with the code I just wrote up top for him..


Best Regards
Max

Nothing is hard when you realy want to learn it.

Max
 
Can you explain that to me? What is going to be replaced? nl2br() replaces newline characters with <br>. If he's trying to PUT a nl/cr into a textarea, what are you suggesting nl2br() will replace with <br>'s?

I assume he's looking to do something like this:

<textarea>This is a \r\ntest.</textarea>

To get the following:
Code:
This is a 
test
What would the parameters for nl2br() be?

--
How can you be in two places at once when you're not anywhere at all?
 
Thanks for all your help but it's working now by using the \n. Here's what I did.

echo '<textarea name=&quot;photoOrder&quot; rows=&quot;10&quot; cols=&quot;50&quot; id=&quot;photoOrder&quot;>'.$photoOrderd.'</textarea>';

And it works fine now. I'm not so sure about the nl2br() because I have not used since the \n has worked.

ljCharlie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top