PHP Form updates XML...uploads FLV

Been working with the scripts found on another Thread (http://www.kirupa.com/forum/showthread.php?t=325746)…

I am trying to make a hybrid PHP form that allows me to rewrite an XML page with following actions:

[LIST=1]
[]update the title tag
[
]update the artist tag
[*]upload a flv file, and update the url tag with the name of the flv file name
[/LIST]

Here is what I have so far…

XML Quote:
<?xml version=“1.0”?>
<musiclist>
<song>
<title>10-24-11</title>
<artist>Clay-9</artist>
<url></url>
</song>
</musiclist>
Then the PHP Action
Quote:
<?php
$uploadDir = ‘songs/’;

if(isset($_POST[‘upload’]))
{
$fileName = $_FILES[‘userfile’][‘name’];
$tmpName = $_FILES[‘userfile’][‘tmp_name’];
$fileSize = $_FILES[‘userfile’][‘size’];
$fileType = $_FILES[‘userfile’][‘type’];
$filePath = $uploadDir . $fileName;

$result = move_uploaded_file($tmpName, $filePath);
if (!$result) {
echo “Error uploading file”;
exit;
}

}

$musiclist = array();
$musiclist [] = array(
“artist” => $_POST[‘artist’],
“title” => $_POST[‘title’],
“url” => $_POST[‘url’]
);

$doc = new DOMDocument();
$doc->formatOutput = true;
$r = $doc->createElement( “musiclist” );
$doc->appendChild( $r );

foreach( $musiclist as $song )
{
$b = $doc->createElement(“song”);

$title = $doc->createElement(“title”);
$title->appendChild(
$doc->createTextNode( $song[“title”] )
);
$b->appendChild( $title );

$artist = $doc->createElement(“artist”);
$artist->appendChild(
$doc->createTextNode( $song[“artist”] )
);
$b->appendChild( $artist );
$url = $doc->createElement(“url”);
$url->appendChild(
$doc->createTextNode( $song[“url”] )
);

$b->appendChild( $url );
$r->appendChild( $b );
}
echo $doc->saveXML();
$doc->save(“musiclist.xml”)
?>
Then the actual PHP Form
Quote:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8” />
<title>Untitled Document</title>
</head>

<body>
<h1>Jukebox Playlist</h1>

<p>Enter the Artist and Title names as you want them to appear on the jukebox. It’ll take a few minutes to upload a song after you click submit, so leave it and don’t close the page until you see it added to the Current Entries list.</p>

        &lt;form action="playlistaction.php" method="post" enctype="multipart/form-data"&gt;

<table>
<tr>
<td colspan="2"class=“labelcell”><label for=“artist”>Artist:</label></td>
<td colspan="2"class=“fieldcell”><input type=“text” id=“artist” name=“artist” tabindex=“1”/></td>
</tr>
<tr>
<td colspan="2"class=“labelcell”><label for=“title”>Title:</label></td>
<td colspan="2"class=“fieldcell”> <input type=“text” id=“title” name=“title” tabindex=“2”/><br />
</td>
</tr>
<!-- <tr>
<td colspan="2"class=“labelcell”><label for=“path”>URL:</label></td>
<td colspan="2"class=“fieldcell”> <input type=“text” id=“url” name=“url” tabindex=“3”/> <br />
</td>
</tr>–>
<tr>
<td colspan="2"class=“labelcell”><label for=“userfile”>Song Upload</label></td>
<td colspan=“2”><input name=“userfile” type=“file” id=“userfile” tabindex=“4”></td></tr>
</td>
</tr>
<td colspan=“4”><input type=“submit” name=“upload” class=“box” value=“Submit” tabindex=“5” /></td>
</table>
</fieldset>
</form>
<h2>Current entries:</h2>
<p>Artist - Title - URL</p>
<?php
$doc = new DOMDocument();
$doc->load( ‘musiclist.xml’ );

$musiclist = $doc->getElementsByTagName( “song” );
foreach( $musiclist as $song )
{
$artists = $song->getElementsByTagName( “artist” );
$artist = $artists->item(0)->nodeValue;

$titles= $song->getElementsByTagName( “title” );
$title= $titles->item(0)->nodeValue;

$urls = $song->getElementsByTagName( “url” );
$url = $urls->item(0)->nodeValue;

echo “<b>$artist - $title - $url
</b><br>”;
}
?>
</body>
</html>
My initial thought was that the script was pooping out (action PHP) at around line 20, where the "array"s are cited…however, I may be wrong.

Any help would be great…

Thanks,

Heimdall