This is my first question, so excuse me if I do something wrong! I try my best!
So I got this simple code
<?php
$fn = "file.txt";
$file = fopen($fn, "w+");
$size = filesize($fn);
if($_POST['addition']) fwrite($file, $_POST['addition']);
$text = fread($file, $size);
fclose($file);
?>
<form action="<?=$PHP_SELF?>" method="post">
<input type="text" name="addition" value="<?php echo file_get_contents('file.txt');?>"/>
<input type="submit"/>
</form>
<iframe width="420" height="315" src="//<?php echo file_get_contents('file.txt');?>" frameborder="0" allowfullscreen></iframe>
It works great, only one small problem ...
Problem
The script works fine, but the problem is that it throws an error:
Warning: fread () expects exactly 2 parameters, 1 is specified in / home / u 799303375 / public_html / beta / private / Test / test.php on line 8
I do not know how to fix this.
What have i tried
- I tried to remove the size of $, did not work, it expects 2 lines to get only 1.
- Nothing yet ...
Help me if you need a working example, just ask not to include it right now!
source
share