Hello,
If am entering data as
"hi
this
is
for
test"
as my input to

<textarea>

but while displaying it, it is giving me as one sentence .
Help me out with this.

Recommended Answers

All 8 Replies

Member Avatar for diafol

You need to use nl2br().

Are you storing in database?

Diafol is correct, before its stored use nl2br as such
nl2br($string);

Hi Priti_P,

A newline escape character would do for an inline and your sample would also do it. example:

<?php

$myString = "MULTILINE:
hi
this
is
for
test";

echo "<textarea rows='6'>" . $myString . "</textarea>";

$myString2 = "INLINE:\nhi\nthis\nis\nfor\ntest";

echo "<textarea rows='6'>" . $myString2 . "</textarea>";

he
use to br there

Member Avatar for diafol

he
use to br there

You wouldn't be sig spamming by any chance?

Out of topic:
I guess with the bb code, and a well crafted keywords in his sig, he is.

Man, I hate spammers.

@lixamaga: Please, people are trying to learn, and share knowledge here; not look at a non-sensical marketing junk.

he guys ..
thanks a lot..!!
nl2br worked in my case.
thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.