# PHP/external text question

**URL:** https://forum.kirupa.com/t/php-external-text-question/95859
**Category:** Uncategorized
**Created:** [December 1, 2003, 9:13pm UTC](https://forum.kirupa.com/t/php-external-text-question/95859 "2003-12-01T21:13:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![macneilslt](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@macneilslt](https://forum.kirupa.com/u/macneilslt)
#### Post date: [December 1, 2003, 9:13pm UTC](https://forum.kirupa.com/t/php-external-text-question/95859/1 "2003-12-01T21:13:30Z")

</div>

okay, i want to set something up on my site using flash, php, and an external text document, so people can leave a brief message…  
not like a guest book, but more like ‘tagging your name’ or something…

so this is my idea:

I have a button with this code:

[AS]  
on (release) {  
loadVariablesNum(“write.php”, 0, “POST”);  
gotoAndStop(2);  
}  
[/AS]

and i have the write.php file like this:

```php

<? 

// Let's declare the 2 variables: 

$name = $_POST['name']; 
$message= $_POST['message']; 

// Let's open the file we want to put the data in: 

if($REQUEST_METHOD == 'POST'){ 
$file = "textdata.txt"; 
$fp = fopen($file, "a+"); 

// Write to the file: 

fwrite($fp, $_POST['name'] . ":" . $_POST['message'] . "
");fclose($fp); 
} 
?> 

```

That posts there name, and message to an external .txt file like this  
name:message, every time some one subits it adds a new line…

i want to use flash to load external text into a dynamic text box, but how can i make it so it only loads the last line, or change the php to over write lines on the text instead of adding new lines???

any ideas?
