我的代码有问题。我收到的错误如下。
此代码中的错误$ vf = $ bn [1];
$ this-> _data ['kabupaten'] - >在html中发帖
此错误:
严重性:通知
消息:未定义的偏移量: 1
文件名:mustahik / mustahik_controller.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;
}
我的观点如下
<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>
任何人都知道问题是什么?
答案 0 :(得分:0)
放置结束标记后会解决问题:
<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>