Jump to content

help with writing/viewing text


codeboy89

Recommended Posts

i have the following code for taking input data and writing it to a textfile then echoing it to a webpage to view. i do not know why sometimes data is left over from a previous submission and sometimes it clears it. i want it to clear out the textfile and only show the last inputed message when i echo it.

 

$file = "msg.txt";
$read = file_get_contents($file);
$open = fopen($file, "r+");
$lock = flock($open, LOCK_EX);
$add = "$msg";

$add = fwrite($open, "$add");
fclose($open);

 

please help

Link to comment
https://forums.phpfreaks.com/topic/207095-help-with-writingviewing-text/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.