I have a problem with text that have new lines.. I insert text in my database like this:
$descrizionetipologia = mysql_real_escape_string($_POST['descrtipologia']);
//insert query
and I take it from the database with
$descrizionetipologia=mysql_result($risultati,$i,"CA_DescrTipologia");
//and I have to show it in a textarea with a javascript function.
document.EDITform.EDITdescrtipologia.value="<?php echo $descrizionetipologia; ?>";
When I set the value of my textarea with $descrizionetipologia, the textarea don't show anything if the text have newline... I added nl2br , mysql_real_escape_string, but I have a lot of confusion about these functions...
if, when I want to show it, I use
$descrizionetipologia=str_replace(array("\r\n", "\n"),"",nl2br(htmlentities($descrizionetipologia)));
I see
PROVA <br> PROVA
but I don't want this...I want the text with new line... I want see
PROVA
PROVA
How can I do this?