Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown Concept Problem

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
IE
Hi All,

Need advice with the floowing issue.

I have a registration form with 10 fields.
The first 3 are dropdowns.
The info in dropdown two will depend on what is choosen in
dropdown one, and dropdown three will depend on dropdown two.

My first question is, should I store all my info in mysql tables to achieve this or is there a better way.

Do I have to use Javascript to achieve this dynamic change or is there a better way.

Once the registration process is complete the info will be submitted into a mysql database so is it better practice to keep everything in a mysql database.

I am really having problems with this as my programming experience is not that extensive.

Could someone please point me in the correct direction on how to achieve this.

Many Thanks

Graham
 
Martin

Thanks for the reply, is this difficult to achieve.

Could you point me in the right direction of how to

do this.

Much appreciated.
 
You have to decide if you want to rely on JavaScript. If you do, then people without JavaScript cannot register using the form.

You can solve it with PHP by redrawing the page and populating the next dropdown after the previous value was chosen.
 
DRJ478

Thats sounds good how do you achieve this result

ie redrawing the page.

Tks
 
There are several ways - one still includes JavaScript.
Scenario a (with JavaScript):
The dropdown has an onChange() event handler which submits the form (to the script itself). The script checks for the presence of a value in the first dropdown and pulls the appropriate values for the second menu. The same process in principle happens for the third dropdown.

Scenario b (no client side code):
You'll do in principle the same, the only thing is that there needs to be a submit button to trigger the page submission.

It is just a series of if statements that draw appropriate parts of the page and execute appropriate SQL statements.
I'm sure you know how to write IF statements, but 'if' you need help with code, just let us know.
 
DRJ478

Thanks for the response.

I think I will go with the Javascript fix as I dont want to have my users to press a submit button each time a dropdown has to be changed.

Is there any chance you could point me in the direction of a good example to achieve this result.

Something that pulls data from a mysql database in order to populate the dropdowns

Regards

Graham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top