Jump to content

updating using dom


myitalan

Recommended Posts

Greetings,

 

I thought I was done.. I had this part working first but now that i fixed the read part... the write part broke. Please help!! i am trying to update or (delete a record based on title) from the xml. 

 

here is the form:

<form action="processForm.php" method="post">

<fieldset>

<label for="title">Title:</label> <input type="text" id="title" name="title"/><br />

<label for="description">Description:</label><input type="text" id="description" name="description" /><br />

 

<select name="action">

<option value="ins">Insert</option>

<option value="del">Delete</option>

</select>

<input type="submit" />

</fieldset>

</form>

 

................................

 

and here is the php:

 

<?

 

$doc = new DOMDocument();

 

$doc->load( 'playlist.xml' );

 

 

$r = $doc->getElementsByTagName("gallery")->item(0);

 

$b = $doc->createElement("images");

 

$title = $doc->createElement("title");

$title->appendChild(

    $doc->createTextNode( $imges["title"] )

);

$b->appendChild( $title );

 

$description = $doc->createElement("description");

$description->appendChild(

    $doc->createTextNode( $imges["description"] )

);

$b->appendChild( $description );

 

$tmb = $doc->createElement("tmb");

$tmb->appendChild(

    $doc->createTextNode( $imges["tmb"] )

);

$b->appendChild( $tmb );

 

$img = $doc->createElement("img");

$img->appendChild(

    $doc->createTextNode( $imges["img"] )

);

$b->appendChild( $img );

 

$r->appendChild( $b );

 

$doc->save("playlist.xml");

....................

 

a couple of things: 

- I only have to input filelds in the form : title, description as the img and tmb is preloaded. 

 

Please help.

Link to comment
https://forums.phpfreaks.com/topic/265853-updating-using-dom/
Share on other sites

i seem to really have difficult request or being new to coding I'm not getting my request across.  If you view this post please at least help me to know which it is.

 

If it's too difficult, please point me to a simpler way or if you don't understand, state so then I could retry.

 

Thanks for all your help.

Link to comment
https://forums.phpfreaks.com/topic/265853-updating-using-dom/#findComment-1362269
Share on other sites

here is s simple tutorial

 

http://www.4guysfromrolla.com/webtech/122800-1.shtml

 

Only thing... it's ASP.  i'm not sure if I'm suppose to say that here but my fellow PHP Gurus are silent.

 

... just pulling your chain in hopes to get a little help.

 

GodBless... last post if no reply

Link to comment
https://forums.phpfreaks.com/topic/265853-updating-using-dom/#findComment-1362323
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.