I have form that uses POST to send information to PHP script. PHP reads $content
and saves it to file.txt
, and also displays it on browser using the following code:
$content = $_POST['content'];
file_put_contents("file.txt", $content);
echo $content;
If I use line breaks in form, then file.txt
contains them all. But when I'm echoing same $content
to browser, there are no line breaks at all. And I mean in source code. My purpose is to use $content
in another forms <textarea>
, but even textarea does not show any line breaks.
How file_put_contents
finds the line breaks?