> Basically I mean this: I load the page, it has two comboboxes 
> (<select> with <option>).
> The first one contains names of countries, the second names 
> of cities within those countries.
> When I select "Belgium" in the first one, I only want to see 
> all Belgian cities.
> Now with JavaScript this wouldn't really be a problem, I  guess, 
> but I need PHP for going into my database.

What I do is this:

Where I set up the form, for the first combo box, I fill it using
the results from the query:

"SELECT * FROM countries"

and name that combo box "country_name".  I set an event on
this combo box to be "OnChange=form.submit();"

For the second combo box, I use the query:

"SELECT * FROM cities WHERE country=\"$country_name\""

So the combo box will be empty the first time into the page but
each time they select a new country, it gets filled appropriately.

I have some checks to determine where the form submission is
coming from so I know whether or not to actually process the
data.

HTH

Chris

Reply via email to