My guestbook flash app won't save the XML

Hi, I’ve been having problems saving my xml file using php. This is the AS code I use:

It has two XML instances, one for input and the other for output. The problem comes when it’s time to do the sendAndLoad function. It loads the new xml file (after adding a new node/post) but when I refresh the whole flash app, it disappears and it turned out that the PHP file didn’t save the xML file that was supposed to be saved.

AS script:

//This is the file to be loaded
var fileXML = "guestbook.xml";
//This is to be outputted to the dynamic text
var outputXML = new XML();
outputXML.ignoreWhite = true;
outputXML.onLoad = function(success) {
 if (success) {
//This xml is to be used in form
var inputXML = new XML();
inputXML.ignoreWhite = true;
//Print guestbook to dynamic text
function printGB () {
 var post = outputXML.firstChild.childNodes;  //<post ... />
 gbdata = "";
 for (var i=0; i<post.length; i++) {
 gbdata += "<b>Name: </b>"+post*"<br>";
 gbdata += "<b>Date: </b>"+post*"<br>";
 gbdata += "<b>Message: </b><br>";
 gbdata += post*.attributes.message+"<br>";
 gbdata += "_______________________<br><br>";
//Create the current Date
var postDate = new Date();
var pDate = (postDate.getMonth()+1)+"-"+(postDate.getDate())+"-"+(postDate.getFullYear());
trace (pDate);
//This sends new post to XML
btn_submit.onRelease = function () {
 //Declare form's variables
 var gb_name = form.gb_name;
 var gb_email = form.gb_email;
 var gb_message = form.gb_message;
 var node = inputXML.createElement("post");
 node.attributes.message = gb_message; = pDate; = gb_email; = gb_name;
 //insert to inputXML
 inputXML.firstChild.insertBefore(node, inputXML.firstChild.firstChild);
 //send XML to PHP to save XML and load it back
 inputXML.sendAndLoad("GBaddPost.php", outputXML);

Here’s the php script:

$filename = "simple_edit.xml"; 
$raw_xml = file_get_contents("php://input"); 
print $raw_xml; 
$fp = fopen($filename, "w");
fwrite($fp, $raw_xml); 
fclose($fp); ?> 

I need immediate help please.