PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
jeremy1987
Forum Newbie
Posts: 3 Joined: Tue Jun 12, 2007 10:57 pm
Post
by jeremy1987 » 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
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');
?>
superdezign
DevNet Master
Posts: 4135 Joined: Sat Jan 20, 2007 11:06 pm
Post
by superdezign » Mon Sep 24, 2007 6:59 am
The lack of a root DOMDocument object can sometimes cause read-only errors, but from the look of your situation, it's as though the DOM just isn't working. Which version of PHP do you have?
jeremy1987
Forum Newbie
Posts: 3 Joined: Tue Jun 12, 2007 10:57 pm
Post
by jeremy1987 » Mon Sep 24, 2007 7:15 am
im using dreamweaver cs3 which has php 5.
mrkite
Forum Contributor
Posts: 104 Joined: Tue Sep 11, 2007 4:19 am
Post
by mrkite » Mon Sep 24, 2007 10:54 pm
I've never created a DOMNode with its constructor.. didn't know it had one. I always used DomDocument->createElement
php.net doesn't show a __construct function for DOMNode.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Sep 24, 2007 11:32 pm
Congratulations ~jeremy1987, you just got your thread locked for bumping it a second time in under 24 hours. This thread will be unlocked in 48 hours.
BUMPING IS NOT TOLERATED.