i have a textrarea that displays a txt document (e.g. <textarea ><?php include(“textdoc.txt”) ?></textarea>). the text document is often updated from an fputs command and would then appear in the textarea. the only propblem is that unless you manually refresh the page the textarea will not show updates in the txt file. so what i would like to do is update the textarea whenever a change is made to the txt document. except that being only a beginner i am clueless on this.
easy answer: just make the page refresh itself every, say, minute using standard html.
easy answer 2: do the same but display the ‘page’ in an iframe - so only that segment of the page is refreshed.
complicated answer: use ajax to check the last modified date of the text file - and if it has changed then go get it again.
Except, if you display the data inside a textarea this suggests that the user is editing the text at the same time, no?
As Cups said, your final technique would all depend if the user is editing the textarea themselves too…?
the user is editing another textarea on the page so i dont want to just refresh the entire page, the iframe sounds promising but im not exactly sure how to do that.
On main page:
<iframe src=“yourHtmlPageSectionContainingOnlyTheTextarea.html”></iframe>
inside yourHtmlPageSectionContainingOnlyTheTextarea.html:
<meta http-equiv=“refresh” content=“5”>
<textarea>blablablabala</textarea>
thanks