Writing a text file with PHP & Flash

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