Do you want to submit every time the dropdown changes?  If you just want the
second dropdown to update and don't want a submit, let me know.  I am doing
this in one of my programs and I can send you some code if you think it
would help. 

Ex of my program:
We want to show populations.  There's a state box and when you select a
state then the county box fills up with counties for that state (along with
an "Entire State" option).  We have them set up using boxes that are 3 tall,
I think (maybe 5).  For some reason it didn't work as well when we did
regular dropdowns, so this was our current workaround.  We use onload in the
body tag, onchange in the state box tag, and use a JS method to populate the
second dropdown.

Good luck!


-----Original Message-----
From: Erik Price [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 10:02 AM
To: Kunal Jhunjhunwala
Cc: php-list
Subject: Re: [PHP] dynamic drop down

On Tuesday, April 23, 2002, at 07:01  AM, Kunal Jhunjhunwala wrote:

> I am trying to make a drop down list such that, when some one selects 
> an option, it refreshs and displays the option on the same page. There 
> are a couple of things already in the URL [ the query string ], which 
> need to remain there. How would I do this easily?

First, you need to use JavaScript (I think the onchange handler) to 
automatically submit the form when the user selects an option from the 
dropdown list.  That's no big deal.

But to maintain the querystring, you will need to do a bit of 
finagling -- but it's nothing hard.  You could either use 
$_SERVER['QUERYSTRING'] and place the value of this variable into a 
hidden form field, or you could do a foreach ($_GET) and concatenate the 
results into a string and place that into a hidden form field.

If you aren't sure what I'm talking about I can write up an example.



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to