0

Hello

I Need Something In My Text Area Field

When Someone Click On {{ Enter }}

It Put A Break Line Between Rows

Like Any Editors

i Was Using Ckeditor But All I Need Is Break-line Between Rows

Example

When I Write

I Love Daniweb
I Respect Daniweb Members
I Wish To learn Everyday

It Show Like This

I Love Daniweb I Respect Daniweb Members I Wish To learn Everyday

I Hope I Explained My Problem

3
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by diafol
0

If I understand correct - Have you tried:

nl2br($your_text_here);

Klemme

Thanks For Help I Will Explain More

You Know ckeditor

Lets Say i Wrote

" Hello Klemme " And Clicked Enter

In Database It Will be Like This

<p > Hello Klemme </ p> Without Spaces

Thats All I Need To Do

1

So you want to build your own text editor?
You could split the text on \n to create an array of lines
Then you can array_map or implode with "</p>\n<p>" and place a "<p>" a the start and a "</p>" at the end:

$text_array = explode("\n",$textbox_text);
$db_text = "<p>" . implode("</p>\n<p>", $text_array) . "</p>";

...store ... $db_text to db ...

Trouble is, you'll need to take off all <p> and </p> when loading this text back into the editor:

$text_to_editor = str_replace(array("<p>","</p>"),"",$text_from_db);

...load text to editor...

Edited by diafol: n/a

0

So you want to build your own text editor?
You could split the text on \n to create an array of lines
Then you can array_map or implode with "</p>\n<p>" and place a "<p>" a the start and a "</p>" at the end:

$text_array = explode("\n",$textbox_text);
$db_text = "<p>" . implode("</p>\n<p>", $text_array) . "</p>";

...store ... $db_text to db ...

Trouble is, you'll need to take off all <p> and </p> when loading this text back into the editor:

$text_to_editor = str_replace(array("<p>","</p>"),"",$text_from_db);

...load text to editor...

Thanks Sir For Your Help I Will Try It

You Got What I Need Thx Again

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.