I have a situation regarding ajax script. Please check the attachments. It is not possible to generate the city list by selection of the state from the database.
aside from having a bad design for your database, it doesn't include any cities. how do you expect to get a list of cities if you don't HAVE a list of cities?
depending on what you're doing -- in theory a city list is convenient and ensures that your customers enter in the correct city name. in practice, not so much. storing a database of every city, town and village in the entire world is insane to say the least. if you were simply listing out locations that you had products in, or something, then you would have a limited list that would be somewhat easy to keep track of. the entire world's list of cities is not so. most people just have a text field that lets a user enter in their city and be done with it.
well, this time your project doesn't include the other table, but I ended up taking it from the original zip file. you're using phpMyAdmin; you know you can export more than one table at once, right?
anyhow, let's get to it.
first problem: your XML for the cities in xml_provided_data2.php is invalid. you are opening the tag <city> and closing it with </state>. you need to close it with </city>.
second problem: xml_provided_data2.php is being given an ID in the GET filter variable (an incorrect ID, at that); you need to give it a string to return the desired result. to fix this, you need to find this line in xml_provided_data.php:
fixing both of the things I've outlined should fix your problem.
now, I can tell by simply glancing at your PHP and the JavaScript file that this is badly hacked together. I would suggest taking some tutorials on how PHP and Ajax work and then attempting to rewrite this entire script. for example, you have a bunch of functions in your JavaScript file that are almost identical to other JavaScript functions with very small changes; these could be merged into one function. you're also connecting to your MySQL database like, four times in your script [you include dbcon.php [1], then actually call mysql_pconnect() [2] within your index file, and then later on you copied and pasted the code that includes dbcon.php [3] and then calls mysql_pconnect() [4]].
I had been working with this for a while and i have created a snippet for myself. Here it is. You can copy the complete page and you can work it out for further usage. This applies to anybody who lands this page.
Just view source that page and download all the includes in script tag. Thats it. I am further expanding my description so in due course of time there will be more information.