Page 1 of 1

Basic "Form" & "Database" concept

Posted: Wed Dec 23, 2009 9:11 am
by mjs1138
I'm building a FORM that will allow a user to enter info into a MySQL DB. The form presents the user w/ some select / pull-downs to select some of the info to be added to the db. The options in the selects are loaded from tables already in the db. The users want to select a value from one pull down (pull-down-A) and have the subsequent value of other pull downs (pull-down-B, pull-down-C, ...) restricted by the value picked in pull-down-A)

Not having done this before and guessing that it's not an uncommon procedure I'm hoping someone can tell me how this is normally accomplished. A possible solution I've thought of is to load the page w/ hidden html and use java script to do the manipulating of the option values in the selects.

Any thoughts will be appreciated.

Thanks --- Mike

Re: Basic "Form" & "Database" concept

Posted: Wed Dec 23, 2009 9:53 am
by JNettles
Cascading drop downs. Yes, you will need Javascript to do this (smoothly). It actually shouldn't be that hard. You'll just need to change dropdowns based on the value of another dropdown when one is changed.

Re: Basic "Form" & "Database" concept

Posted: Wed Dec 23, 2009 12:20 pm
by mjs1138
JNettles, thank you. Looks like just what I was looking for.

Thanks --- Mike

Re: Basic "Form" & "Database" concept

Posted: Thu Dec 24, 2009 8:45 am
by omniuni
Another possible solution if you want to avoid JS is to present the form in a "step-by-step" manner. Let the user enter information, and click "next". POST the information to the next page which will store it as hidden values, and present the appropriate related drop-down, while indicating that they are on "step two".

Re: Basic "Form" & "Database" concept

Posted: Thu Dec 24, 2009 11:49 am
by josh
I built an entire software product based on the idea. You could view my demo sites on http://www.vehiclefits.com, the jquery code is not obfuscated or encrypted in any way.