-1

I have two textboxes, Zip Code and City. When the user enters a Zip, the City should be automatically generated in the city textbox.

The Zip Code and City are stored in the a table in the Database. My Backend is PHP using kohana 2.3.4 framework and DoctrineORM. and My Database is MySQL.

Rodney Folz
  • 6,709
  • 2
  • 29
  • 38

1 Answers1

1

One way to do this is with a javascript async httprequest. Use javascript to detect changes in the Zipcode textbox, create a httprequest to a second php page that takes a http variable for zip code, let this page search the right city in the database and put in on the html as a simple text in the http response read the html you get from the request and extract the city from it. display the city in the right textbox.

Thomas
  • 595
  • 1
  • 5
  • 20
  • thanks thomas it make sense, i am a newbie here, do you have links for relevant tutorials on what you are saying? – user1039666 Dec 11 '11 at 15:43
  • You might want to take a look at this: http://www.w3schools.com/xml/xml_http.asp or take a look at this stackoverflow question: http://stackoverflow.com/questions/247483/http-get-request-in-javascript – Thomas Dec 12 '11 at 08:06
  • it may be better to update on blur() instead of when the value changes – darryn.ten Feb 28 '12 at 07:49