# Append XML File With flash with PHP

**URL:** <https://forum.kirupa.com/t/append-xml-file-with-flash-with-php/246520>\
**Category:** flash\
**Created:** [December 11, 2007, 11:25pm UTC](https://forum.kirupa.com/t/append-xml-file-with-flash-with-php/246520 "2007-12-11T23:25:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![josephnwachukwu](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@josephnwachukwu](https://forum.kirupa.com/u/josephnwachukwu)\
**Post date:** [December 11, 2007, 11:25pm UTC](https://forum.kirupa.com/t/append-xml-file-with-flash-with-php/246520/1 "2007-12-11T23:25:16Z")

</div>

Hello Everyone,  
I am having trouble updating my xml file I have set the correct permissions and everything. I have a blog and i want to make a front end updater for it. here are the sourcees maybe theres something wrong in it.  
this is writeAttributes.php

```php

<?php
   
    $titleValue = $_POST['title'];
    $descriptionValue = $_POST['description'];
    $imageValue = $_POST['image'];
    $dateValue = $_POST['date'];
    $fromValue = $_POST['from'];

    
    $dom = domxml_open_file("catalog.xml");
    $root = $dom->document_element();
    
    $story = $dom->create_element("story");

    $title = $dom->create_element("title");
    $titleText = $dom->create_text_node($titleValue);
    $title->append_child($titleText);
   
    $description = $dom->create_element("description");
    $descrtiptionText = $dom->create_text_node($descriptionValue);
    $description->append_child($descrtiptionText);
    
    $image = $dom->create_element("image");
    $imageText = $dom->create_text_node($imageValue);
    $image->append_child($imageText);
   
    $date = $dom->create_element("date");
    $dateText = $dom->create_text_node($dateValue);
    $date->append_child($dateText);
    
    $from = $dom->create_element("from");
    $fromText = $dom->create_text_node($fromValue);
    $from->append_child($fromText);
    
    $story->append_child($title);
    $story->append_child($description);
    $story->append_child($image);
    $story->append_child($date);
    $story->append_child($from);
    
   $root->append_child($story);
   

    if ($dom->dump_file("catalog.xml", false, true)){
        echo "result=success";
    }else{
        echo "resut=failure";
    }

?>

```

this is my actionscript

```auto

stop();
var myXML = new XML;
var submitVars:LoadVars = new LoadVars();
var returnVars:LoadVars = new LoadVars();
returnVars.onLoad = function(success) {
    if (success) {
        if (this.result="success") {
            loadXml();
        } else {
            trace("something's jacked up, jack");
        }
    } else {
        trace("no return from php.");
    }
};
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
    if (success) {
        trace(myXML);
        submit_mc.enabled = true;
        get_mc.enabled = true;
    } else {
        trace("xml.noLoad();");
    }
    submit_mc.enabled = true;
    get_mc.enabled = true;
};
function loadXml():Void {
    myXML.load("catalog.xml");
}
submit.onRelease = function() {
    if (title1.text == "" || title1.text == undefined || description.text == "" || description.text == undefined || image.text == "" || image.text == undefined || date.text == "" || date.text == undefined || from.text == "" || from.text == undefined) {
        return;
    } else {
        this.enabled = false;
        //this._parent.get_mc.enabled = false;
        submitVars.title = title1.text;
        submitVars.description = description.text;
        submitVars.image = image.text;
        submitVars.date = date.text;
        submitVars.from = from.text;
        // for local testing
        submitVars.sendAndLoad("writeAttributes.php", returnVars, "POST");
        // for live server use
        //submitVars.sendAndLoad("addQuote.php", returnVars, "POST");
    }
};

```

I appreciate any comments or help i can get.

Joseph Nwachukwu
