Mark Mckee wrote: > I have now noticed some glaring errors in my code. > > a) when i put a " in the data field it returns this in the file \" > > b) i cannot get line breaks to work. no matter how many carriage returns > there are, i always end up with a load of text jumbled up. > The extra backslash could be solved by using stripslashes(). E.g.: $sData = 'Something in this \"string\" is wrong...'; $sData = stripslashes($sData); // $sData should now be 'Something in this "string" is wrong...' As for the line breaks, that could be a problem with the type of systems being used. If you're editing your file on Windows, but writing it to the text file on a Linux server (or vice-versa, or something involving a Mac along the way), what you're experiencing can happen. For these situations, PHP comes with a predefined constant that holds the right format for line breaks. You'll have to split your strings to use it, though. Example: Current situation: $sData = 'The quick brown fox jumped over the lazy dog'; New situation: $sData = 'The quick brown fox jumped' . PHP_EOL . PHP_EOL . 'over' . PHP_EOL . PHP_EOL . 'the lazy dog'; HTH, Rick.