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
https://forums.phpfreaks.com/topic/161486-values-dynamically-into-dropdown/
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();
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.