TextArea line breaks for e-mail

China☆狼群 提交于 2019-12-01 09:21:05

use \n for new line, or \r\n for return followed by new line

ie.

<?php
printf("This is the first line. \n");
printf("This is the second line");
?>

ie. to replace
html tag with newline:

str_replace ('<br>' , '\r\n', $_POST['field'])

alternativly set the email you are sending out to be html encoded (add html header)

Use nl2br() function. It replaces all newlines within a string with html br tags.

In php, replace \n with html br tag,

$newTxt = str_replace("\n",'<br>',$txt) 

or nl2br() will serve your purpose.

Deepak Verma

remove stripslashes(), this will work.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!