Forum Moderators: coopster
<?php
$q=$_GET["q"];$xmlDoc = new DOMDocument();
$xmlDoc->load("book2.xml");
$x=$xmlDoc->getElementsByTagName('title');
for ($i=0; $i<=$x->length-1; $i++)
{
//Process only element nodes
if ($x->item($i)->nodeType==1)
{
if ($x->item($i)->childNodes->item(0)->nodeValue == $q)
{
$y=($x->item($i)->parentNode);
}
}
}
$cd=($y->childNodes);for ($i=0;$i<$cd->length;$i++)
{//Process only element nodes
if ($cd->item($i)->nodeType==1)
{
echo($cd->item($i)->childNodes->item(0)->nodeValue);
}
}
?>
[php.net...]