City Controller aspects
Provincial area
Public Function one () {
$data =db::table (' area ')->where ("Parent_id=0")->select ();
$AA = $data [0][' id ']+100;
$shi _ji=db::table ("area")->where ("Parent_id= ' $aa '")->select ();
$arr =[' data ' and $data, ' Shi ' and $shi _ji];
return View ("Show", [' arr ' = $arr]);
}
City-level areas
Public Function () {
$id =request::instance ()->param ("id");
$b =db::table (' area ')->where ("Parent_id= ' $id '")->select ();
return View ("Show1", [' arr ' = $b]);
}
Province
Public Function three () {
$id =request::instance ()->param ("id");
$b =db::table (' area ')->where ("Parent_id= ' $id '")->select ();
return View ("Show2", [' arr ' = $b]);
}
//html page Show page shows provincial city
<table>
<tr>
<td> Provincial:</td>
<td>
<select name= "" id= "" class= "one" >
<option value= "Please select" > Please select </option>
{volist name= "arr.data" id= "V"}
<option value= "{$v. ID}" >{$v .name}</option>
{/volist}
</select>
</td>
<td> City-level:</td>
<td>
<select name= "" id= "" class= "" >
<option value= "" ></option>
</select>
</td>
<td> County/District:</td>
<td>
<select name= "" id= "" class= "three" >
<option value= "" ></option>
</select>
</td>
</tr>
</table>
//js Call Show1 show2 page
$ (document). On ("Change", ". One", function () {
var one=$ (this). Val ();
$.get (
"{: url (' login/two ')}?id=" +one,
function (data) {
$ ("."). HTML (data);
}
)
})
//Urban
$ (document). On ("Change", ".", Function () {
var two=$ (this). Val ();
$.get (
"{: url (' login/three ')}?id=" +two,
function (data) {
$ (". three"). HTML (data);
}
)
})
Show1 Show Level Two cities
<select name= "" id= "" class= "one" >
<option value= "" > Please select </option>
{volist name= "arr" id= "V"}
<option value= "{$v. ID}" >{$v .name}</option>
{/volist}
</select>
Show2 Show Level Three cities
<select name= "" id= "" class= "one" >
<option value= "" > Please select </option>
{volist name= "arr" id= "V"}
<option value= "{$v. ID}" >{$v .name}</option>
{/volist}
</select>
Second-level linkage