Add and edit XML with PHP

Hi there!

Im currently working on a script which allows me to enter new posts in a XML-file.

The XML (“config.xml”) is read by a flash application to show videos. The XML-template is as follow, and is entered for each new movie I want to publish:


      <item>
         <title>$title</title> // from form ($_POST)
         <description><![CDATA[$description]]></description> // short description of movie
         <url>$URL</url> // URL to the moviefile (FLV)
         <thumb>$thumb_url</thumb> // URL to thumbnail
      </item> 

I’ve created a short PHP-script which allows me to enter this details through a form. On the top and the bottom of the file there’s a tag <movie> and </movie>, and using the fgets()-function with a “while”, the script is searching for the first <movie>-line and place the new entery right below it.

The source code can be found here: http://norskwebforum.no/pastebin/10961 (text in norwegian, but I think you’ll understand the point).

Now, I really want to add the functionality to edit and delete posts, but I don’t know how to do this. Maybe I can generate the XML with a database, but I started with PHP two weeks ago, so I’m still pretty n00b at this. I’ve read about SimpleXML in PHP5 as a easier way of doing this, but at this point this is a little too complicated to understand…

Summary: The point is to add, edit and delete items from the XML-file within a graphical interface.

So any help would’ve been much appriciated! (I’ve done a search and found some good examples, but couldn’t transfer them into my example :/)