473,836 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto populate fields from sql database.

2 New Member
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 4850
3,406 Recognized Expert Specialist
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
2 New Member
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 Recognized Expert Specialist
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 Recognized Expert Contributor
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 Email_Address - Char50 Mailshots - tick box
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 use code: Name=cbBox.column(3) to get the value. It works fine, but I have problem with performance. The source of the combo box is a table from another database that keeps adding up (currently we have around 1500 records, around 5-20 new records...
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 want "Doug" to populate the FIRST Name field and "Ford" to populate the Last Name field. At present I have to manually enter them. I have a table called Name ID in which I have stored the swimmers ID numbers , first and last names in the...
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 letter. If I edit the description for one record, it edits the same for all records in which I've applied the same autofill (auto lookup). I'm set up where the letters come from a lookup combo box (limit to list "Yes") and the record source for the...
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 computer components and peripherals (i.e networking devices, hard drives etc etc), the previous mentioned devices are in a table called product catagories which in the form, are a drop down. I also have 2 text box fields, 1 is for the product...
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. The species list has 7 fields the first is a four digit unique identifier (species) it is set as the primary key. I have created a relationship to the data collection table which also has a species field (4 digit id). In my form I have the species...
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 autopopulate three fields for that ID # record. (The three fields are called pu, am, and qu). Pu should populate with a vaule of 1. Am should populate with a value of 38. Qu should populate with a value of 1. Can you please send me the code? Thank you!
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 tbl_Input has three fields: OSE_Job, OSE_Name, OSE_Wt I have populated tbl_OSE_Info table. I need to create a form that will store the data in tbl_Input I have racked my brain so much trying to figure out how to auto populate a field based on a...
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, with standard info such as Customer, order Number, etc. > Im trying to autopopulate one of the feilds on the form, called Reference Number. > The SQL column on the backend auto increments fine > The Reference Numbercolumn has identity...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.