472,365 Members | 1,161 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,365 software developers and data experts.

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:

Expand|Select|Wrap|Line Numbers
  3.   `id` int(10) default NULL,
  4.   `Make` text,
  5.   `Model` text,
  6.   `Year_` text,
  7.   `Car_Fuel` text,
And here is a sample of the data inserted in to this database:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO `car` (`id`, `Make`, `Model`, `Year_`, `Car_Fuel`) VALUES
  2. (1, 'Toyota', '4Runner SR5 4x4', '2004', 'Gasoline'),
  3. (2, 'Ford', 'Fiesta 1.4', '2003', 'Diesel'),
  4. (3, 'Seat', '4Runner SR5 4x4', '2004', 'Diesel'),
  5. (4, 'Volkswagen 2.0', 'Golf', '2008', 'Gasoline'),
  6. (5, 'Nissan', '300z', '2004', 'Petrol'),
  7. (6, 'Ford', 'Fiesta 1.8', '2005', 'Gasoline'),
  8. (7, 'Porsche', '356 America', '1952', 'Diesel'),
  9. (8, 'Lancia', 'Hit', '1988', 'Gasoline'),
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.
Oct 4 '09 #1
4 4724
3,406 Expert 2GB
Unfortunately classic ASP doesn't do this for you automatically. First you will need to connect to the db, then pull the data you are interested in in a recordset (similar to a DataTable in .NET). Do you need help with this part?

After you have that done, you just need to loop through the db as you fill in the <select> drop down options. This is fairly easy, so don't worry about it until you have the first part done.

The tricky part is how do you get the second drop down box to respond to the selections you make in the first drop down (so if you select "Ford" make sure only Ford models are available in the next drop down). For this ASP is not sufficient, you will need to branch out to Javascript or Ajax. Anyway, let me know when you have the first part done, and I'll try to give you a hand on the next step.

Oct 5 '09 #2
You see I have fair knowledge of php but lacking knowledge of AJAX, I'm willing to pay for this script if someone is interested in making it.

keep in mind it should only show the years a make of cars has and further on only the fuel types for make and year, so finally you only get the models of cars according to [Make] --- populate ---->[Year] --- populate ----> [Fuel] --- populate ----> [Models] the reason is to eliminate misspellings by the user and then when the listing is submitted other data comes up according to the model selected (As could be number of doors, fuell milage and so on...)

The Sample sql I have provided is only for referance, it has many more colums in the table car: (`id`, `Make`, `Model`, `Year_`, `Car_Fuel`, 'another', 'another'...)

But I only want the Auto populating drop downs at this moment.
Oct 5 '09 #3
3,406 Expert 2GB
Well, I've seen a couple ways to do it before Ajax got big. A lot of sites used to submit the form after the first selection is made, then the page is reloaded with everything in place, the second select ready. I've also seen it done with a whole bunch of selects in hidden divs, then the correct div made visible when on e selection is made. If both of those sound awkward, then you see the reason why Ajax is used. I can help with either of those other options, but if you want an ajax solution (or if you want to contact an Ajax expert) post in the javascript/ajax forum.

Oct 5 '09 #4
564 Expert 512MB
Hello olidenia,

I am not interested in making money from helping you out. But, if you want to donate funds to BYTES then I am sure the owners of the site would appreciate it very much.

What I am interested in is providing solutions to people that need help. Do you what a example solution in Classic ASP? I know Jhardman is willing to help out too..

Oct 9 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: David Shorthouse | last post by:
HI is it posible to auto populate an access database.? I have 1 table structured Index_ID. - Index & auto number First_Name - Char50 Surname - Char50 Initals - Char50 Postcode - Char50...
by: BK | last post by:
Hi, I have a problem. I need to auto populate fields based on a value entered in combo box. Initially, I put all the required fields in the combo box, and hide it (set to 0",0",0", ...), then...
by: Geoff Portbury | last post by:
I'm a swimming club coach. I have a data base for recording times at various meets. I have a FORM for entering times called SWIM TIMES. When I enter the swimmers name ID, eg FOR01 for Doug Ford I...
by: Jim | last post by:
I have a new database in which I have a form where in one field I type a letter A, B, C or D and the field next to it autofills (auto lookups) with a description associated with the specific...
by: jacklindsay | last post by:
Hello smarter people than me I am creating a database for college, and have requested some help, but they are unable to help me. ( im obviously too eager) anyway, im creating a database on...
by: joshua.nicholes | last post by:
I have an access database that consists of two tables.A data collection table and a species list table. The data collection table has about 1500 records in it and the species list has about 600....
by: zeilak | last post by:
I am running Windows XP, Access 2002. I want to know the VB code for the following: I want to type in the ID # (it's the primary key and is auto-numbering) and then have the access form...
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
by: paulyXvpf | last post by:
Hi All, FACTS: > I've created a VB.NET 2005 form, with a SQL Server 2000 backend > The form has about 30 fields that populate 30 columns in the SQL database > The form has mostly text feilds,...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.