Page 1 of 1

database structure for drop down options in form

Posted: Wed Jul 10, 2013 6:43 am
by dazzy
Hi

I want to build a form with drop down lists of car makes and models

The first option will be make of car and the second will be the model of the car.

I will pull the information in from a database to fill in the second option dependent on the make of car.

Does anyone know the best structure of table to create this?

Would it be best to use 2 different tables? One for makes of cars and one for all models of cars? and have them connect dependent on the id of the make of car in the makes table?

Re: database structure for drop down options in form

Posted: Wed Jul 10, 2013 7:55 am
by Celauran
That's how I would structure it. car_models.manufacturer_id as a foreign key referencing car_manufacturers.id or somesuch.

Re: database structure for drop down options in form

Posted: Wed Jul 10, 2013 3:46 pm
by dazzy
Yeah I think I will go that way

Thanks for the help