TapeGun007 Posted December 1, 2015 Share Posted December 1, 2015 I have looked at probably 50 different types of coding for this, but they all do not necessarily use a database. I have a field where the user selects a state. Once the state is selected I want the code to pull up the counties for that state. Again, I already have all the states in one table and the counties in another table. Each state has it's own ID that links to the counties that are in the that state. How can I do this with Javascript or Jquery? Quote Link to comment https://forums.phpfreaks.com/topic/299613-auto-population/ Share on other sites More sharing options...
Barand Posted December 1, 2015 Share Posted December 1, 2015 When you first generate the page, populate the first menu. Then use the onchange event to generate an ajax call, passing the selected state. The script on the server will then query the database for counties in that state and pass them back as an array. Use that array to populate the second menu. Quote Link to comment https://forums.phpfreaks.com/topic/299613-auto-population/#findComment-1527388 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.