IronCode
12-06-2004, 03:18 PM
Ok i just read the post below this one hoping it might be similar but the issue at hand for me is slightly different. What i've got is three select boxes that needs to be filled. I'm using PHP and MySQL to generate the boxes and pull the data from the database. The first field is auto-populated by a simple query to mysql and a while loop in php.
Now the second select box needs to be automatically filled (should be totaly empty at page load if there wasn't a value in the database for that field to start with) based on the selection of the first field.
The third select box works exactly like the second box other then different information that is based on the input of the second box rather then the first.
Ok i hope you understand all that :) now the issue i'm having is that i don't have a clue how to do this. I've read a few posts on a few forums and seen a few ways to do this but everybody is refering to generating only 2 select boxes rather then three and none of them is considering that there might have to be a automatically selected value in them based on information in the database. for example here are three example peaces of information,
select box one,
1) Car
2) truck
3) Boat
select box two,
1) Mazda (1.car)
2) Ford (1.car)
3) Chevy (1.car)
4) Ford (2.truck)
5) Chevy (2.truck)
6) Dodge (2.truck)
7) Fishing (3.boat)
8) Motorizd (3.boat)
9) Rowing (3.boat)
select box three,
1) Pretege (1.car.1.mazda)
2) 626 (1.car.1.mazda)
3) 323 (1.car.1.mazda)
4) Mustang (1.car.2.ford)
5) Focus (1.car.2.ford)
6) Escort (1.car.2.ford)
7) Camaro (1.car.3.chevy)
so so so
you see the links between the tables? i mean i don't know if the approach should be that way or not but how do you even attack something like this if you don't kow much about javascript? i'm a n00b at javascript and need to get this done asap.
But in the example above if you selected "Car" in the first dropdown then the second box should auto fill in "Mazda","Ford","Chevy" the third box would still be empty until they select one of those three. So if they select "Mazda" the third box should have "Protege",626", "323".
However if there is already results in the database for these fileds then we need to load them as the default values. Man this is a lot isn't it..
Now the second select box needs to be automatically filled (should be totaly empty at page load if there wasn't a value in the database for that field to start with) based on the selection of the first field.
The third select box works exactly like the second box other then different information that is based on the input of the second box rather then the first.
Ok i hope you understand all that :) now the issue i'm having is that i don't have a clue how to do this. I've read a few posts on a few forums and seen a few ways to do this but everybody is refering to generating only 2 select boxes rather then three and none of them is considering that there might have to be a automatically selected value in them based on information in the database. for example here are three example peaces of information,
select box one,
1) Car
2) truck
3) Boat
select box two,
1) Mazda (1.car)
2) Ford (1.car)
3) Chevy (1.car)
4) Ford (2.truck)
5) Chevy (2.truck)
6) Dodge (2.truck)
7) Fishing (3.boat)
8) Motorizd (3.boat)
9) Rowing (3.boat)
select box three,
1) Pretege (1.car.1.mazda)
2) 626 (1.car.1.mazda)
3) 323 (1.car.1.mazda)
4) Mustang (1.car.2.ford)
5) Focus (1.car.2.ford)
6) Escort (1.car.2.ford)
7) Camaro (1.car.3.chevy)
so so so
you see the links between the tables? i mean i don't know if the approach should be that way or not but how do you even attack something like this if you don't kow much about javascript? i'm a n00b at javascript and need to get this done asap.
But in the example above if you selected "Car" in the first dropdown then the second box should auto fill in "Mazda","Ford","Chevy" the third box would still be empty until they select one of those three. So if they select "Mazda" the third box should have "Protege",626", "323".
However if there is already results in the database for these fileds then we need to load them as the default values. Man this is a lot isn't it..