don't like to reply when I don't have an answer but this one will probably stump everyone - can you redescribe? here's my best stab:
function write_field_to_file($fieldName, $fileName){
$addTo=stripslashes($_POST[$fieldName]); //this is a global variable, use stripslashes if needed b/c of magic quotes
$fp = fopen($fileName, "a");
fwrite ($fp, $addTo);
fclose($fp);
}
//call it
write_field_to_file('preview.txt', 'homepage');
you were writing a javascript string vs the posted value of the text area - you can't do that