Can't changing an xml value with PHP

Casey

New Member
This is my XML-file:\[code\]<todos> <todo> <titel>sasd</titel> <erstellt>2012-04-30 17:19:21</erstellt> <erledigen_bis>2012-05-03</erledigen_bis> <erledigt>Nein</erledigt> <thingstodo>sffsdfdf</thingstodo> </todo></todos>\[/code\]Now I want to change the value inside of the \[code\]<erledigt>\[/code\] tag to 'Ja'.I tried this with the following code:\[code\]<?php$filename = 'xml/todos.xml';$xmlDoc = new DOMDocument();$xmlDoc->load('xml/todos.xml');$todos = $xmlDoc->getElementsByTagName('todo'); foreach ($todos as $todo) { $titel = $todo->getElementsByTagName('titel'); $actualTitel = $titel->item(0)->nodeValue; $paramTitel = $_GET["titel"]; $erstellt = $todo->getElementsByTagName('erstellt'); $actualTimestamp = $erstellt->item(0)->nodeValue; $paramTimestamp = $_GET["timestamp"]; if ($paramTitel == $actualTitel && $paramTimestamp == $actualTimestamp) { $todo->erledigt= 'Ja'; }}$xmlDoc->save($filename);header('Location: todo.php');?>\[/code\]Please help me, I searched for about 5 hours on the web and couldn't find any solution for my problem.
 
Back
Top