# Html text saving to text file?

**URL:** <https://forum.kirupa.com/t/html-text-saving-to-text-file/35345>\
**Category:** Uncategorized\
**Created:** [November 12, 2003, 11:15pm UTC](https://forum.kirupa.com/t/html-text-saving-to-text-file/35345 "2003-11-12T23:15:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SoloDesignz](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@SoloDesignz](https://forum.kirupa.com/u/SoloDesignz)\
**Post date:** [November 12, 2003, 11:15pm UTC](https://forum.kirupa.com/t/html-text-saving-to-text-file/35345/1 "2003-11-12T23:15:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 13, 2003, 12:59am UTC](https://forum.kirupa.com/t/html-text-saving-to-text-file/35345/2 "2003-11-13T00:59:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 13, 2003, 1:03am UTC](https://forum.kirupa.com/t/html-text-saving-to-text-file/35345/3 "2003-11-13T01:03:32Z")

</div>

this is the code im using…

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 13, 2003, 2:37am UTC](https://forum.kirupa.com/t/html-text-saving-to-text-file/35345/4 "2003-11-13T02:37:39Z")

</div>

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

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

```
