Dear friends of daniweb.com;
An annoying problem has been arisen in muy php code. Here is the code :
$doc = new DOMDocument();
$doc->load("http://localhost/xampp/tsbs_yellow_pages/run/databank.xml");
$xPath = new DOMXPath($doc);
$nodeList = $xPath->query("/Root/User");
//Everything is normal up to that point I think
$phase;
$length_of_phase;
$areaPointer=99;
$i=0;
//In these "if" blocks , I try to determine which area has been filled by user.
/*
$in_name = $_POST["name"];
$in_surname = $_POST["surname"];
$in_department = $_POST["department"];
has been declared before.
*/
if($in_name != '')
{
$areaPointer = 1;
$phase = trim(($in_name));
$length_of_phase = strlen($phase);
}else if($in_surname != '')
{
$areaPointer = 2;
$phase = trim($in_surname);
$length_of_phase = strlen($phase);
}else if($in_department != '')
{
$areaPointer = 3;
$phase = trim($in_department);
$length_of_phase = strlen($phase);
}
for( $i=0 ; $i<($nodeList->length)-1 ; $i++)
{
switch($areaPointer)
{
case 1:
echo "here";//Next line is the error point.
if( strncasecmp($nodeList->item[$i]->getElementsByTagName('name')->item[0]->nodeValue,$phase,$length_of_phase) == 0 )
{
echo("<p>$$nodeList[$i]->nodeValue</p>\n");
}
break;
How can overcome that problem. Thanks in advance.