【发布时间】:2015-01-03 23:45:51
【问题描述】:
我需要在输入邮政编码时自动填写 CITY: 表格, 它说“未定义的变量:在线数组..” where value="
有人可以帮忙吗?
http://i62.tinypic.com/hv5fkl.jpg
<div id="search">
<form name="input" action="" method="get">
POST:<input type="text" name="postcode"><br><br>
City:<input type="text" name="navn" value="<?php $array['navn'] ?>"><br><br>
<input type="submit" value="search">
</form>
</div>
</div>
<?php
if(isset($_GET['postcode'])){
$postcode = $_GET['postcode'];
$content = file_get_contents('http://oiorest.dk/danmark/postdistrikter/'. $postcode . '.json');
$array = json_decode($content, true);
echo $array['navn'];
echo "<br>";
}
?>
【问题讨论】:
-
使用
$array[$_GET['navn']];获取值 -
在我的输入表单中?自动填充会有帮助吗?
标签: php json autofill zipcode city