Jump to content

Auto Population


TapeGun007

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.