June 20th, 2000, 12:30 AM
I need to build a dynamic page with 2 drop down boxes on it where the contents of the second drop down box are dependent upon the selection made in the first drop down box (the first box contains districts/regions and the second box contains towns/cities). The customer wants this to happen on a single screen but can this be done with PHP?
June 20th, 2000, 02:09 AM
You should use client side scripting for this(Java Script).
"The fear of the LORD is the beginning of knowledge..."
June 20th, 2000, 11:39 PM
In combobox1, when a user selects a values, it automatically submits the form. On the second page, you evaluate what the user chose, then create the second combobox based on the value of the first. Then show both boxes again...
A lot of sites use code like this, i think it's the only way to do it. you can actually do this all in one page (the action of your form being $PHP_SELF) so the submit process would be a pretty short time...
June 21st, 2000, 05:09 AM
June 21st, 2000, 06:19 AM
>>The customer wants this to happen on a single screen
Go to -> http://www.essex1.com/people/timothy/js-index.htm and click "RB LEAP TO 3".
This example uses checkbox and textarea, you need alter it to make both a drop-down menu.
June 21st, 2000, 04:14 PM
Ulysses J Ludwig
June 21st, 2000, 04:29 PM
Thanks people - you've given me enough to get on and do it.
June 21st, 2000, 09:31 PM
June 21st, 2000, 10:41 PM
Client side PHP? Now that would be nice...It's be so nice to refer to a text box as $text instead of window.document.form.text.value etc..etc....
it'll probably never happen, but it's interesting....
June 22nd, 2000, 02:36 PM
July 26th, 2000, 10:33 PM
This has surfaced again.
Thanks in advance.
July 26th, 2000, 11:22 PM
Create your first select form with onClick="document.formname.submit()" in the select tag where formname is the name you have given to your form and $PHP_SELF as the action then you will have the choice they selected after you submit then I assume you will mkae a query based on the choice and draw up another select box. Hope that helps.