Page 1 of 1
textarea and file_get_contents problem!
Posted: Thu Dec 23, 2004 1:17 pm
by Joe
I am using file_get_contents() to read the contents of a file into a textarea, however I have discovered a small problem. Everytime the textarea tag is within the actual textarea itself it cuts off and the html starts displaying all over the page. Can someone please help here?.
Regards
Joe
Posted: Thu Dec 23, 2004 1:20 pm
by kenrbnsn
Apply htmlentities() to the string before displaying it. This will change any angle brackets and other special HTML punctuation to the corresponding "words". i.e. "<" to < ">" to >
Then your text will display correctly.
Posted: Thu Dec 23, 2004 1:26 pm
by Joe
I did think of that but this edits files aswell. Will this not disturb the overall file?. I will try it out for once

Posted: Thu Dec 23, 2004 2:01 pm
by rehfeld
the browser will reinterpret things when submitting the form. it should work.
Posted: Thu Dec 30, 2004 10:20 pm
by ianlandsman
Yes that should always work, when the browser transforms the special chars the transformed characters will be submitted.