Mobile app version of vmapp.org
Login or Join
Rambettina238

: How to fix xml and php live search 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

@Rambettina238

Posted in: #Error #Html #Php #Search #Xml

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 webdam.inria.fr / Jorge / files / movies.xml

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



This is my php code: getmovie.php

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Rambettina238

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme