I've always wanted some application for array_walk_recursive. Cool beans. Array_walk_recursive() will start at the parent node and work its way through the generations of nodes. For each node it walks through, it adds the required children. $post_array is the POSTed array that you're using.
Use SimpleXML to start an XML element and continue adding children, then write it into tester.xml.
PHP Code:
<?php
$xml = new SimpleXMLElement('<root/>');
array_walk_recursive($post_array, array ($xml, 'addChild'));
// Then just write it to your XML sheet.
$postdata = file_get_contents("php://input");
// Append your XML data to the sheet.
$postdata .= $xml->asXML();
$fp=fopen("tester.xml","w+");
fwrite($fp,$postdata."\t");
?>
Bookmarks