Guest aceooo2 Posted March 14, 2007 Share Posted March 14, 2007 Hi, At the moment I can append an html file by actually opening it and typing in what I want. Then it outputs the whole file when I save it. <?php $loadcontent = "terms.html"; if($save_file) { $savecontent = stripslashes($savecontent); $fp = @fopen($loadcontent, "a"); if ($fp) { fwrite($fp, $savecontent); fclose($fp); } } $fp = @fopen($loadcontent, "r"); $loadcontent = fread($fp, filesize($loadcontent)); $loadcontent = htmlspecialchars($loadcontent); fclose($fp); ?> <form method=post action="<?=$_SERVER['PHP_SELF']?>"> <textarea name="savecontent" cols="70" rows="25"><?=$loadcontent?></textarea> <br> <input type="submit" name="save_file" value="Save"> </form> <?php $myFile = "terms.html"; $handle = fopen($myFile, 'r'); while (!feof($handle)) { $data = fgets($handle, 512); echo $data; echo "<br>"; } fclose($handle); ?> Is there a way to change the user input to make it a textbox/area then save, instead of opening the file itself and adding data. (User input at End of file would be OK ) Also can it only show what the user has just entered when reading it, as the file is fairly large? ace - thanks EDIT: sorry i relise its opening it twice at the moment Link to comment https://forums.phpfreaks.com/topic/42697-user-entry-showing-appended-data-only-in-text-area/ Share on other sites More sharing options...
Guest aceooo2 Posted March 14, 2007 Share Posted March 14, 2007 sorry, any ideas at all? Link to comment https://forums.phpfreaks.com/topic/42697-user-entry-showing-appended-data-only-in-text-area/#findComment-207280 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.