Do not save the changed data in db, just save the original, so when you present it to the user, they can easily edit them.
As for displaying them when you present the output to the users browser, use the regex as indicated by zrekms above
$text = preg_replace("~\s*[\r\n]+~", ', ', $text);
.
, BTW , , , , ...
$arr = explode("\n", $var);
$arr = explode("\r\n", $var);
$arr = explode("\r", $var);
$arr = explode(PHP_EOL, $var);
PHP_EOL char .