我的代码有问题。我得到的错误如下:
$vf=$bn[1];$ this→_data("县")→Post in html
此错误:
严重性:Notice
消息:Undefined offset:1
Filename: mustahik/mustahik_controller.php
Line .php数量:1108
我的控制器代码如下
$this->_data['kabupaten'] = "";
if($this->_data['kab'] != $this->_data['kabupaten']) {
$vf = $this->_data['kab'] ;
$cf = $vf;
echo "kk".$cf;
} else {
$bn = explode('.',($this->_data['kabupaten']), 3);
$vf = $bn[1]; /// error here
$cf = $vf;
echo "kk".$cf;
}
My view is a below
<tr>
<td>Kab/Kota<span class="red">*</span></td>
<td>
<input type="text" name="kab" value="<?php echo $survey['kabupaten'];?>">
<select name="kabupaten" id="kabupaten" style="width: 100%;" class="select2" onchange="get_districts(this.value);" >
</select>
<option value="<?php echo $survey['kabupaten'];?>"></option>
</td>
</tr>
有人知道是什么问题吗?
在后面放置结束标签将解决问题:
<tr>
<td>Kab/Kota<span class="red">*</span></td>
<td>
<input type="text" name="kab" value="<?php echo $survey['kabupaten'];?>">
<select name="kabupaten" id="kabupaten" style="width: 100%;" class="select2" onchange="get_districts(this.value);" >
<option value="<?php echo $survey['kabupaten'];?>"></option>
</select>
</td>
</tr>