Working with files is pretty simple in PHP. A simple example of writing to a file is below.
<?php
$fp = @fopen("file.txt","w");
fwrite($fp, $data);
fclose($fp);
?>
In this example, the contents of the variable $data are being written to the file. You need to make sure that your webserver has permissions to write to this file or it will fail.
For more details, check out the filesystem section in the PHP manual.
--Vamsi
http://php.vamsi.net