Html text saving to text file?

I have a variable that is in a text file, which contains HTML that i load into my project and it displays it as html in a textbox…

Im trying to have a MC in there that I can change the html text and save it over the file thats already there…

and then next time i load it up, it will load the html text that i just created and saved to the file…

Could anyone help me out with this one?
Might just be a simple like php scripting or osmething that saves it to a txt file? i tried looking through the forum… but havent found anything that could help me yet… thanks in advance

Well i got it to write to the text…
but every ’ or " i have it adds a \ before it
and then when i try and load that it wont load with the 's in there
also it only saves so much, wont save alot of info…
Can anyone help me out with this? thanks

this is the code im using…

<?
$file = fopen("main.txt", "w+");
fwrite($file, "text=$text", 100);
fclose($file);
?>

Well I figured it out…
If anyone else has this problem heres my code…
hope i did it right, but works fine for me =)

<?
$file = fopen("main.txt", "w+");
$text = stripslashes($text);
fwrite($file, "text=$text", 1000000);
fclose($file);
?>