RE: [PHP] HTML/PHP's static state problem.

From: Date: Mon, 09 Jul 2001 16:46:59 +0000
Subject: RE: [PHP] HTML/PHP's static state problem.
Groups: php.general 
Request: Send a blank email to php-general+get-56967@lists.php.net to get a copy of this message
> 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

« previous php.general (#56967) next »