ok .. so the input feild has an id ... trying to implement a live search in that input feild The source code in "livesearch.php" searches an XML file for titles matching the search string and returns the result: <?php $xmlDoc=new DOMDocument(); $xmlDoc->load("links.xml"); $x=$xmlDoc->getElementsByTagName('link'); //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('url'); 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="<a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } else { $hint=$hint . "<br /><a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } } } } } // Set output to "no suggestion" if no hint were found // or to the correct values if ($hint=="") { $response="no suggestion"; } else { $response=$hint; } //output the response echo $response; ?> PHP: now i need to make sense of this code <html> <script> javascript javascript function livesearch.php <?php livesearch.php <?xml file.xml
So, do you want all that above code explaining? I suggest you look functions up at www.php.net and experiment with each one, so that you understand what they do. Then you will be able to read the code and understand the whole.
I'm not totally getting you (if you still have a problem or have fixed it)? You might be best off sticking with one thread: https://forums.digitalpoint.com/threads/php-live-search-product.2667638/ And post exactly what you are having a problem with (in words rather than images).
It is input type = text which means you are going to input in text format. It will be used to enter data by the user and can be read by any server side scripting and can be used later to process on data