Asp updating database from dropdown box

6854933580_2c8b688306_z

Hi I am creating an order form where the user will select their first choice (Item assembly) from the first dropdown, and the parts belonging to that Assembly are displayed in the second dropdown.All part references are stored in an my SQL database.I also need to add more pairs of dropdowns by say the user clicking a button, This is so the users can add as many items to the order as they require.I.e Assy 1 ------ Part 1_1 10 off Assy 1 ------ Part 1_2 5 off Assy 4 ------ Part 4_3 1 off etc.This list will get longer if the user need to add more lines. I'm testing this with a DSN to a database on the web at the moment.Thanks in advance Okay -- first question: did you want to do this on the client or the server side? This will change to a IP based connection when it goes live.Since you're here in the ASP area, I had assumed that perhaps you'd like to do this on the server side using postbacks, etc. Do you know how to connect to a db, create a dropdownbox dynamically, etc.? E., I'm trying to get a feel for exactly how much help you need before I dive into some detailed explanation that may not be necessary. I can populate the first dropdown without a problem from the DB, but obviously I'm coming unstuck when it comes the the second linked dynamic dropdown.Thanks Okay -- thanks for the further detail, that makes sense to me now.

Now that you know this value, and you know what the user has done, you can use it to dynamically populate your next dropdown box and display that for the user. Here's an example of posting a form on Change of a dropdown box: Please note that you'll obviously have to persist your dropdown values between form posts... Ok Thanks for that, But is submitting to itself, and where do I set my SELECT * FROM to populate the second dropdown.Let me know if you have any other questions about this. You see I am trying to do this within on ASP page rather than multiple pages, so if the user picks Assembly 1, the parts that belong to assembly 1 appear in the second dropdown.If the user then wants to add another line to the order they click a button, and another set of dynamic dropsdowns appears and the repeat of the above happens, pick assembly, then pick part etc.Until the users has ordered all parts and they submit the order form. ns Franklin -- indeed, this makes sense, and I apologize for my late response to your comment. Can you let me know what your table structures are?The tables I would need would be for the assemblies, parts, and the relationship between the two tables (assembly ID, or whatever it might be). Here is the data structure Columns ID top_assy stock_code description. top_assy contains multiple duplicate entries which I have used a SELECT DISTINCT Top_Assy FROM parts, sql command to populate my first drop down.If you give me that information, I should be able to come up with a workable example that will get you to where you need to be. The second dropdown will need to do a SELECT * FROM parts WHERE Top_Assy = "dropdown1".

You must have an account to comment. Please register or login here!