Below is my xml table, i have already created php to add a book but i am struggling on how to update the nextID by one let say i add a book at id 101 but how do i update so NextID displays 102 not 101.
<?xml version="1.0"?>
<catalogue>
<nextID>101</nextID>
<tasks>
<task id="100">
<title>Task Three</title>
<taskleader>Cara Forbes</taskleader>
<participants>Alex Lord</participants>
<targetdate>25/10/2016</targetdate>
<summary>Test Text Area</summary>
<status>completed</status>
<url>www.taskthree.com</url>
</task>
</tasks>
</catalogue>
In response to above.
what i have so far whicj correctly adds a task
$root= $xml->documentElement;
$nextIDNode=$root->childNodes->item(0);
$tasks= $root->childNodes->item(1);
$firstTask=$tasks->childNodes->item(0);
$newID=(int)$root->childNodes->item(0)->nodeValue;
$updateID = $newID + 1;
$newTitle=$_POST["addTitle"];
$newTLead=$_POST["addLead"];
$newPart=$_POST["addPart"];
$newDate=$_POST["addDate"];
$newSum=$_POST["addSum"];
$newStat= "new";
$newUrl=$_POST["addUrl"];
$titleNode=$xml->createElement("title");
$titleTextNode=$xml->createTextNode("$newTitle");
$titleNode->appendChild($titleTextNode);
$taskLeaderNode=$xml->createElement("taskleader");
$taskLeaderTextNode=$xml->createTextNode("$newTLead");
$taskLeaderNode->appendChild($taskLeaderTextNode);
$taskPartNode=$xml->createElement("participants");
$taskPartTextNode=$xml->createTextNode("$newPart");
$taskPartNode->appendChild($taskPartTextNode);
$taskDateNode=$xml->createElement("targetdate");
$taskDateTextNode=$xml->createTextNode("$newDate");
$taskDateNode->appendChild($taskDateTextNode);
$taskSumNode=$xml->createElement("summary");
$taskSumTextNode=$xml->createTextNode("$newSum");
$taskSumNode->appendChild($taskSumTextNode);
$taskStatNode=$xml->createElement("status");
$taskStatTextNode=$xml->createTextNode("$newStat");
$taskStatNode->appendChild($taskStatTextNode);
$taskUrlNode=$xml->createElement("url");
$taskUrlTextNode=$xml->createTextNode("$newUrl");
$taskUrlNode->appendChild($taskUrlTextNode);
$newTaskNode=$xml->createElement("task");
$newTaskNode->setAttribute("id",$newID);
$newTaskNode->appendChild($titleNode);
$newTaskNode->appendChild($taskLeaderNode);
$newTaskNode->appendChild($taskPartNode);
$newTaskNode->appendChild($taskDateNode);
$newTaskNode->appendChild($taskSumNode);
$newTaskNode->appendChild($taskStatNode);
$newTaskNode->appendChild($taskUrlNode);
$tasks->insertBefore($newTaskNode,$firstTask);
$xml->save("tasks.xml");
$add = "Task added";
echo $add;
$xml->save("tasks.xml");