I have a textarea and I want to open a text file and read it inside this textarea, I was watching a course explaining how we can do this and I wrote the cods as he wrote it in the video ,but there is a problem because the words in the file do not appear in the textarea, can anyone help me? ... HTML :
<form>
<h1>Write:</h1>
<textarea ><?PHP echo $text; ?></textarea>
<button>POST</button>
</form>
PHP codes :
<?php
$text="";
if($_SERVER['REQUEST_METHOD']=='POST'){
$myfile= fopen("myfile.txt","r");
$text= fread($myfile,filesize("myfile.txt"));
fclose($myfile);
}
?>
And i put All of them in the body