You probably want to use the stripSlashes() method.
$newText = stripSlashes($textfield);
If that doesn't work, here is some code that works from my personal lib. Just use it:
make an html file with this in it:
<head>
<title>file changer</title>
</head>
<body>
<form action=fileChange.php method=post name="">
<textarea name="textfield" cols="80" rows="20"></textarea>
<input type="submit" name="Submit2" value="save">
</form>
</body>
then make a file called fileChange.php in the same directory with this in it:
<?
//remove slashes
$text = stripslashes($textfield);
//file to write to
$filename = "myfile.txt";
//open it and write
$handle= fopen($filename,'w');
fputs($handle, $text);
//close it
fclose($handle);
//output link to new file!
echo "<body>done!<a href=myfile.txt> here</a></body>";
?>
view the html file in browser, and click the link to view the text file. If your problem is still there, it is not php's fault because that works fine for me!
Luke