データベースを3階層連携させる方法

WBOY
リリース: 2016-06-20 12:46:43
オリジナル
890 人が閲覧しました


このように、国を選択すると、地方、都市、都市部が表示されます。都市部を選択すると、地方、都市、国の選択が表示されます。

<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>
ログイン後にコピー


ディスカッションへの返信 (解決策)

何をしたいのか分かりません
データベースの設計が良くないのでしょうか
それともコードの書き方が分かりません

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!