Home > Backend Development > PHP Tutorial > 数据库三级联动怎么做

数据库三级联动怎么做

WBOY
Release: 2016-06-20 12:46:43
Original
914 people have browsed it


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

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