数据库三级联动如何做

WBOY
Release: 2016-06-13 12:25:45
Original
986 people have browsed it

数据库三级联动怎么做

   这么做到选择国家的时候省市和市区显示  选择市区的时候出现省市和国家的选择  。   

<form action="city.php?module=add" method="Post" name='frmdirection' id='frmdirection'><br />	<input type="hidden" name="id" value="{$data.id}" id="uid"/><br />    <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="ttbb2"><br /><br />		<tr><br />        <td width="40%" align="right" bgcolor="#e9f4ff"><strong>地区/行政区域</strong></td><br />        <td><br />		<input type="radio" name="pos_occu" value="2" {if $data.parentid eq "" or $data.parentid neq "99999"}checked="checked"{/if}  onclick="clickRadio()"/>地区<br />        <input type="radio" name="pos_occu" value="0" {if $data.parentid eq "" or $data.parentid neq '99999'}checked="checked"{/if}  onclick="clickRadio()"/>省份<br />        <input type="radio" name="pos_occu" value="1" {if $data.parentid eq '99999'}checked="checked"{/if} onclick="clickRadio()"/>国家<br />        <br />         </td><br />        </tr><br />        <tr><br />        <td width="40%" align="right" bgcolor="#e9f4ff"><strong>名称</strong></td><br />        <td><input type ="text"  class="txt150"   name = "data[name]" value="{$data.name}"  id="name"><br />          </td><br />        </tr><br />        <tr  ><br />        <td width="40%" align="right" bgcolor="#e9f4ff"><strong>所属国家</strong></td><br />        <td><br />        <select name = "data[parentid]"   id="parentid"  {if $data.parentid neq '99999'}  style="max-width:90%"{else}style="display:none"{/if}><br />          	{foreach from=$parent item=item key=index}<br />            <option value="{$item.id}"<br />            {if $item.id eq $data.parentid && $data.parentid neq ""}<br />            selected="selected"<br />            {/if}<br />            >{$item.name} </option><br />            {/foreach}<br /><br />          </select><br />          </td><br />        </tr>  <br />		<tr ><br />        <td width="40%" align="right" bgcolor="#e9f4ff"><strong>所属省份</strong></td><br />        <td><br />        <select name = "data[parentid]"   id="parentid"  {if $data.parentid neq "99999"}style="display:block"{else}style="display:none"{/if}><br />          	{foreach from=$parent item=item key=index}<br />            <option value="{$item.id}"<br />            {if $item.id eq $data.parentid && $data.parentid neq ""}<br />            selected="selected"<br />            {/if}<br />            >{$item.name} </option><br />            {/foreach}<br /><br />          </select><br />          </td><br />        </tr>  <br /></table><br /></form><br />
Copy after login

------解决思路----------------------
没明白 你想干什么 
是数据库设计不好 
还是代码不会写

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!