Text with "enters", and html codes

Hi guys , im trying to make a site of news with yii , but when i insert a new text in the database it goes without the Html , and i need to put <p> when i need an enter , could some one help me

This functions will be your friends ;)

PHP: htmlentities

PHP: htmlspecialchars

PHP: nl2br

where do i put these functions , i need that the text that i entered in the text area goes to the DB with html codes, for eaxample:

i entered:

test test

test test

and it saves like this: test test test test . in the database.

how can i save it to goes like this

test test <BR>test test

If only linebreaks are needed, save the text to database as is, and use nl2br() function when you display it in the view.

If you need more formatting, then try a javascript based rich text editor: CKEditor ,TinyMCE.

Use nl2br.

<edit>phtamas beat me to it ;) </edit>

it worked , thanks phtamas , it was just what i was needing