# Writing a text file with PHP & Flash

**URL:** https://forum.kirupa.com/t/writing-a-text-file-with-php-flash/155063
**Category:** Uncategorized
**Created:** [July 14, 2005, 2:26pm UTC](https://forum.kirupa.com/t/writing-a-text-file-with-php-flash/155063 "2005-07-14T14:26:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jcwilde1](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jcwilde1](https://forum.kirupa.com/u/jcwilde1)
#### Post date: [July 14, 2005, 2:26pm UTC](https://forum.kirupa.com/t/writing-a-text-file-with-php-flash/155063/1 "2005-07-14T14:26:44Z")

</div>

I have been trying to get a flash file to update/write a text file useing php. Basicly I want to have an input box that sends the data to php but I have done countless tutorials and no luck on changing the text file at all.  
The PHP that I have been using have been  
\<?php

$title = $\_POST[‘Title’];

$toSave = “Title=”.$title.";

$fp = fopen(“savefile.txt”, “w”);  
if(fwrite($fp, $toSave)) echo “writing=Ok”;  
else echo “writing=Error”;  
fclose($fp);  
?\>

-OR-

\<?php

$filename =“savefile.txt”;  
$writeError = false;  
$fileStream;

if (!$fileStream = fopen($filename,‘a’)) {  
$writeError = true;  
} else {  
if (!fputs($fileStream, $stuffToWrite)) {  
$writeError = true;  
} else {  
fclose($fileStream);  
}  
}

print “&wroteFile=”.$writeError;  
?\>

In flash I have just used a simple Post method but know I am missing something.  
-Josh
