-1

When I use the function nl2br like result I see /r /n

example:

in a textarea I wrote

Hello,
how are you?,
fine

php

echo nl2br($_POST['message']);

result to screen

\r\nHello,
\r\nhow are you?
\r\nfin

how can I fix it? thank you

Fabrizio Fenoglio
  • 5,767
  • 14
  • 38
  • 75

1 Answers1

0

try this:

$newmessage = preg_replace('#(\\\r|\\\r\\\n|\\\n)#','<br />', $_POST['message']);
cainstir
  • 11
  • 1