Jump to content

Values dynamically into dropdown


Recommended Posts

Hello.

 

I have a database with two tables, car makes and car models.

 

The car makes is setup like this:

make_id | make_name

1            ford

 

etc etc

 

car models is setup like this:

model_id | make_id | model_name

1              1            mustang

 

etc etc

 

I've got a dropdown box with all the makes in, but when a make is chosen i need it to activate another text box and display the models for that make_id.

 

Any suggestions on how i might do this?

 

thanks.

Link to comment
Share on other sites

Hi,

 

You can use ajax for this. use onchange to call the ajax function to get the models.

 

for example,

 

<select name="make" onchcange=get_models(this);">
.....
</select>

<input type="text" name="model" value="">

function get_model(id)
{
   call ajax function();
}

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.