You can use both JavaScript and PHP.
Initially use PHP to get your data, you can use 13 arrays to store this
data.
1st array stores the options for the 1st list.
The other 12 arrays can store options related to each item of the 1st
list/array.

Use JavaScript (client-side scripting, faster) to populate the 2nd list
based on the selection in the 1st list.
This way you do not run PHP (server-side scripting, slower) more than once
on the same page.

this is of course, keeping in mind, that your backend (database data) is not
changing every few seconds. If you are dealing with dynamic data, such that
the list options might be changing at every moment then you would need the
latest database data and PHP would need to be used after the selection in
the 1st list.

-Naintara


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
t]On Behalf Of Peter Goggin
Sent: Saturday, July 06, 2002 10:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Linked drop down selection lists and dynamically
generated links


I have two related tables. The first has about 12 records, each of which is
related to about 12 records in the second table.  I want to have two
interconnectedt dropdown list fields. The fisrt is used to select from the
first table and when the value has been selected, use it to determine the
contents of the second drop down list.  Once the second field has been
selected I want to use this data to otain the name of the form to be used to
display data selected using the two fields.

Obviously I can do this by having interrelated pages where the value from
the first fields is carried to the second page and used to populate the
second drop down list. I can then presumably dynamically generate the link
to the required page and pass over what paraeters are needed.

Is there any way of doing this so within a single page?

Can this be done using only PHP or do I need to use Javascripts?
Where would I be able to find examples of code which does this sort of
processing?

Any adivice would be gratefully received.
Regards


Peter Goggin

Regards

Peter Goggin


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to