peuge Posted April 4, 2009 Share Posted April 4, 2009 Hi all, I have a small app, which takes a users input from a textarea, what I am doing is using javasctipt onkeyup to update a preview area by sending the new data to preview.php, the problem is that if a user presses 'enter' my preview.php file is not picking up those line breaks up? All other text is fine I have tried using these: $text being the get variable. //THIS echo nl2br($text); //AND THIS - with \r \n and \r\n $textArr = str_split($text,1); foreach ($textArr as $text){ $text = ($text == '\r\n') ? $text = '<br/>' : $text = $text; echo $text; } I do not need to preserve copy and paste text, just when a user is simply typing in the textarea Any help much appreciated Link to comment https://forums.phpfreaks.com/topic/152515-line-breaks-from-textarea/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.