line breaks - PHP nl2br() basic function -


Can anyone help me with this mail script?

I'm just trying to send an HTML email and a part of the message is from a user Texter, which puts in \ r \ n.

I think Nl2br or any other similar function unable to use it. I am not using the code given below, but still generate error.

Code:

  $ to = 'example@gmail.com'; $ Theme = 'test topic'; $ Message_var_1 = 'test1 \ r \ n test2 \ r \ n test3'; $ Message = nl2br ("
$ message_var_1 & lt; / div> & lt; / div & gt;"); $ Header = 'mime-version: 1.0' "\ r \ n"; $ Headers = 'Content-type: text / html; Charset = ISO-885 9-1 '"\ r \ n"; $ Headers = 'X-Mailer: PHP /'. Phpversion (). "\ R \ n"; Mail ($ $ $ $ theme, $ message, $ headers);

message_var_1 = 'test1 \ r \ n test2 \ r \ n Test3 ';

PHP

\ r and \ n within ", not inside '. Therefore nl2br will not apply here.

  $ message_var_1 = "test1 \ r \ n test2 \ r \ n test3"; $ message = & Lt; div & gt; & lt; div & gt; nl.br ($ message_var_1). & Lt; / div> & lt; / div & gt; ';  
< P> This should work.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -