# Writing to a txt file... without overwriting

**URL:** https://forum.kirupa.com/t/writing-to-a-txt-file-without-overwriting/247855
**Category:** Uncategorized
**Created:** [December 31, 2007, 4:21am UTC](https://forum.kirupa.com/t/writing-to-a-txt-file-without-overwriting/247855 "2007-12-31T04:21:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chrisclick](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/chrisclick/32/1991_2.png) [@chrisclick](https://forum.kirupa.com/u/chrisclick)
#### Post date: [December 31, 2007, 4:21am UTC](https://forum.kirupa.com/t/writing-to-a-txt-file-without-overwriting/247855/1 "2007-12-31T04:21:04Z")

</div>

ok people…

How can i write to a txt file without overwriting the existing data instead making go to a new line?

my current code to write to a txt file is:

```php

<?php

$myFile = "test.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $_GET['text'] . "-" . $_GET['name'];
fwrite($fh, $stringData);
fclose($fh);

?>

```

Anyone know?
