I have a text box where users enter text (with the number of returns as they want), and I take this value, paste it into the database and update the textarea value using one in the database.
<textarea maxlength="500" cols="110" name="description" rows="15"><?php if(isset($newDesc)) echo snl2br_lose(nl2br($newDesc)); else echo nl2br_lose(nl2br($user->desc));?></textarea>
is my html. The problem I am facing is that when sending the value and pasting it into the database, it doubles the number of rows when it fills the value of the text field. Therefore, if they print
Hi, line break foobar
he will make the textarea value
Hey line break line break foobar
function nl2br_lose($string) {
return str_replace('<br/>', '
', str_replace('<br />', '
',str_replace('<br>', '
',str_replace('<br >', '
',$string))));
}
- , , nl2br textarea "". , nl2br_lose ,
, . .
!