This php ajax application example uses ajax+php to call the city's secondary linkage menu, so that we can update it in real time based on the database content.
This php tutorial ajax application example uses ajax+php to call the city's secondary linkage menu, so that we can update the content of the database tutorial in real time.
Ajax+php application example of secondary linkage menu without refreshing
Please select a province (autonomous region):
www.bKjia.c0m.php code
$city_arr = array(
"ah"=>"Hefei",
"fj"=>"Fuzhou",
"gs"=>"Lanzhou",
"gd"=>"Guangzhou",
"gx"=>"Nanning",
"gz"=>"Guiyang",
"hn"=>"Haikou",
"hb"=>"Shijiazhuang",
"hh"=>"Zhengzhou",
"hl"=>"Harbin"
);if(empty($_get['prov']))
{
echo iconv("gb2312","utf-8",'You have not selected a province (autonomous region)');
}
else
{
$prov = $_get['prov'];
$city = $city_arr[$prov];
echo iconv("gb2312","utf-8",'The capital (capital) of the selected province (autonomous region) is:'.$city);
}
?>