Jump to content

AJAX and XML - Searching XML File


Recommended Posts

I have started out with the code at http://www.w3schools.com/php/php_ajax_xml.asp and modified it to use an input text box instead of a drop down. This text box is to enter a part number, which is marked in the XML file as <partnumber>. The issue I am having is there are possibilites of the same part number being listed multiple times and the code is only pulling up the last time it appeatrs (seems that it may be overwriting the 1st occurance with the 2nd). This would be the same issue with the example unchanged, if you added another album by any of the filtered artist it would pull only the last one in the XML. My question is -- what do I need to do to return all occurances of the input string? I know it should be something in the .php file, and I have tried creating a foreach loop, but it is not working or I am putting it in the wrong place. Can anyone help me solve this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...