themoon
10-22-2007, 03:10 AM
HI,
I have 2 mysql tables, namely country, city
country:
id, cont_name, is_enabled
city:
id, city_name, country_id
I have done a php function which pull the list of countries in from the db
and i output in the select option this way
<select name="countryid">
<option value="0" selected="selected">Select Country</option>
<?php get_all_countries(); ?>
</select>
Now, how can list all of the cities upon selecting the country from the drop down menu without refreshing the page. That's the concept of ajax.
& i want if the city is not available, a text box should be enabled for the user to type in the city which is not available in the drop down menu.
Thanks in advance.
I have 2 mysql tables, namely country, city
country:
id, cont_name, is_enabled
city:
id, city_name, country_id
I have done a php function which pull the list of countries in from the db
and i output in the select option this way
<select name="countryid">
<option value="0" selected="selected">Select Country</option>
<?php get_all_countries(); ?>
</select>
Now, how can list all of the cities upon selecting the country from the drop down menu without refreshing the page. That's the concept of ajax.
& i want if the city is not available, a text box should be enabled for the user to type in the city which is not available in the drop down menu.
Thanks in advance.