XML DOM Error
Posted: Mon Sep 24, 2007 5:46 am
im simi new to php and ive tried everything that I can think of but i keep getting this error can someone please help me out.
Heres the error i keep getting
Fatal error: Call to undefined function: appendchild() in /uploadscript/1stupload.php on line 40
Heres the error i keep getting
Fatal error: Call to undefined function: appendchild() in /uploadscript/1stupload.php on line 40
Code: Select all
<?php
error_reporting( E_ALL ); ini_set( 'display_errors', 'on' );
$uploadLocation = "images/";
if (isset($_POST['submitBtn'])){
$target_path = $uploadLocation . basename( $_FILES['upfile']['name']);
if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {
echo "The file: ". basename( $_FILES['upfile']['name']).
" has been uploaded!";
}
else
{
echo "There was an error uploading the file, please try again!";
}
}
$dom = new DOMNode('1.0');
///////////////////////RIGHT HERE IS THE PROBLEM ///////////////////////////////////////////////////////////
$books = $dom->appendChild($dom->createElement("books"));
$book = $books->appendChild($dom->createElement('book'));
$description = $book->appendChild($dom->createElement('description'));
if(isset($_POST['description']))
$description = $_POST['description'];
else //error
$title = $book->appendChild($dom->createElement('title'));
$title->appendChild(
$dom->createTextNode('description'));
$dom->formatOutput = true;
$test = $dom->saveXML();
$dom->save('test.xml');
?>