hi,
i got two select in my page, and i would like the second select to have it's value dynamically changed based on values for first select.
e.g. my first select is country while my second select one is state. so obviously whenever the user specify a country the second select will changed automatically.
can anyone specify a direction or keyword for me to overcome this scenario ?
thx a lot..
[solve]dynamic values for select option
Moderator: General Moderators
[solve]dynamic values for select option
Last edited by tkarven on Mon Aug 08, 2005 11:13 pm, edited 2 times in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
SELECT * FROM countries
INNER JOIN states
USING (country_id)
WHERE countries.name = 'Canada'so countries.php?name=Canada
Code: Select all
$sql = 'SELECT * FROM countries
INNER JOIN states
USING (country_id)
WHERE countries.name = \''.$_GET['name'].\'';- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
Last edited by harrisonad on Mon Aug 08, 2005 10:17 pm, edited 1 time in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
$sql = 'SELECT * FROM countries
INNER JOIN states
USING (country_id)
WHERE countries.name = \''.$_GET['name'].'';
if (isset($_GET['state'])) {
$sql .= ' AND states.name = \''.$_GET['state'].'\'';
}