For writing files see the "Filesystem functions", just pick the filename from your first drop down box. See the example in fread (which reads from a file), you will use fwrite instead.
As for code, there is plenty of code around (px.sklar.com, phpclasses.upperdesign.com, www.weberdev.com, etc.) that shows reading/writing of files.
Happy reading.