Preserve line breaks in textarea

前端 未结 4 1883
生来不讨喜
生来不讨喜 2020-11-27 16:11

I have a form with a textarea and I want to preserve line breaks entered by the user when outputting the content.

For exemple, if I write in textarea :

4条回答
  •  北海茫月
    2020-11-27 17:02

    You keep output in textarea as it is. You would receive input as a string output that string(write to file) that string adding textarea to the input string.

    for eg.
    ". $txt ."";
    $file = fopen("file.html","a+");
    fwrite($file, $txt1);
    fclose($file);
    ?>
    

提交回复
热议问题