It sounds like work for http://php.net/manual/en/function.nl2br.php
string nl2br ( string $string [, bool $is_xhtml = true ] ) Returns string with '<br />' or '<br>' inserted before all newlines (\r\n, \n\r, \n and \r).
You can use this when you echo data, so you never change what is in the database, or you can simply change the user input when it is saved in the database. Personally, I'm a fan of the first option, but all that works best for your application.
Edit: if you want to use the <p> tags, you can also do this using str_replace :
$text = '<p>'; $text.= str_replace('\n', '</p><p>', $_POST[text]);
\n usually a new line, depending on how it is read, you may need to use \r\n , and replacing the line will do the rest. This will leave a spare <p> at the end of the line, but you will see where this happens.
source share