/    Sign up×
Community /Pin to ProfileBookmark

Auto populate fields from sql database.

I need some help or tips on the following.

I have a .sql database file with the folowing structure:

[CODE]
DROP TABLE IF EXISTS `car`;
CREATE TABLE IF NOT EXISTS `car` (
`id` int(10) default NULL,
`Make` text,
`Model` text,
`Year_` text,
`Car_Fuel` text,
) ENGINE=InnoDB DEFAULT CHARSET=latin1;[/CODE]

And here is a sample of the data inserted in to this database:

[CODE]
INSERT INTO `car` (`id`, `Make`, `Model`, `Year_`, `Car_Fuel`) VALUES
(1, ‘Toyota’, ‘4Runner SR5 4×4’, ‘2004’, ‘Gasoline’),
(2, ‘Ford’, ‘Fiesta 1.4’, ‘2003’, ‘Diesel’),
(3, ‘Seat’, ‘4Runner SR5 4×4’, ‘2004’, ‘Diesel’),
(4, ‘Volkswagen 2.0’, ‘Golf’, ‘2008’, ‘Gasoline’),
(5, ‘Nissan’, ‘300z’, ‘2004’, ‘Petrol’),
(6, ‘Ford’, ‘Fiesta 1.8’, ‘2005’, ‘Gasoline’),
(7, ‘Porsche’, ‘356 America’, ‘1952’, ‘Diesel’),
(8, ‘Lancia’, ‘Hit’, ‘1988’, ‘Gasoline’),
[/CODE]

And so on… up to 42000 different cars

How would I get around to make auto populating dropdown boxes selecting data from the database in the following order:

First dropdown: Make
Second auto populate: Car_Fuel
Third: Year
And then only show the Models acording to the above.

Thanks beforehand for any help or tips at all, I have done other scripts but on this one I dont know where to start.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @olid spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...