Jump to content


Photo

Dependant List Boxes?


  • Please log in to reply
5 replies to this topic

#1 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 15 October 2006 - 08:21 PM

Hi again guys,

I was wondering if there's any way of coding dependant list boxes in PHP? What I mean buy that is the values of one list box(child) is chaged depending on the values of another(parent)?

So I have 2 list boxes...

Example:

1. Make
2. Model

Make contains:  Taylormade
                        Ping
                        Nike

So if Ping is chosen in the first box I want the Model box to populate with Ping models:

G5
Rapture
G2
etc...

Or if Taylormade is chosen I want the Model box to populate with Taylormade models:

R7 Quad
R5 Series
etc...

Any ideas??






Welcome to 9AM Monday, the furthest point away from 5PM Friday.

#2 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 15 October 2006 - 08:35 PM

If you mean that you want it to happen instantly, and both boxes be on the same page, i think that's a javascript thing.

If they are to appear on consecutive pages, then php can be used.

#3 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 15 October 2006 - 08:37 PM

Yeah I want it to appear on the same page. So the instant one is changed, so is the value of the other!
Is it definatly javascript?

Does anyone know a way this can be done?

www.carzone.ie have a good example. You select the type of car and it fills the next box with the models of that car.
Welcome to 9AM Monday, the furthest point away from 5PM Friday.

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 15 October 2006 - 08:44 PM

Take a look at the baaSelect link in my sig (javascript solution).

Another opton is AJAX (see other link)
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 15 October 2006 - 08:53 PM

Thanks . . thats brilliant!! :)
Welcome to 9AM Monday, the furthest point away from 5PM Friday.

#6 knowram

knowram
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts

Posted 15 October 2006 - 09:04 PM

It looks like I am trying to do a similar thing. If you don’t mind me asking what ended up working for you?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users