Hi i have been wondering on how to make a live search on my movie website and im trying to do it without a database. So i decided to go with php and xml. These are my code so far. please help me fix this error.

this is my error load("movie.xml"); $x=$xmlDoc->getElementsByTagName('movie'); //get the q parameter from URL $q=$_GET["q"]; //lookup all links from the xml file if length of q>0 if (strlen($q)>0) { $hint=""; for($i=0; $i<($x->length); $i++) { $y=$x->item($i)->getElementsByTagName('title'); $z=$x->item($i)->getElementsByTagName('genre'); if ($y->item(0)->nodeType==1) { //find a link matching the search text if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q)) { if ($hint=="") { $hint="" . $y->item(0)->childNodes->item(0)->nodeValue . ""; } else { $hint=$hint . " " . $y->item(0)->childNodes->item(0)->nodeValue . ""; } } } } } // Set output to "no suggestion" if no hint was found // or to the correct values if ($hint=="") { $response="no suggestion"; } else { $response=$hint; } //output the response echo $response; ?>

this is my xml movie file http:// webdam.inria.fr / Jorge / files / movies.xml

This is my html code. file name: livesearch.html

enter image description here

This is my php code: getmovie.php

enter image description here

  • This question appears to be off-topic because it is about web development which is off-topic at Pro Webmasters. Web development questions may be asked at Stack Overflow but be sure to read their FAQ before posting to ensure your question meets their guidelines. – John Conde Mar 4 '17 at 19:47

Browse other questions tagged or ask your own question.