消息:在CodeIgniter中为foreach提供的参数无效 [英] Message: Invalid argument supplied for foreach in CodeIgniter
本文介绍了消息:在CodeIgniter中为foreach提供的参数无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Codeigniter的应用程序期间面临的几个问题 - 创建一个像
i am facing few issues during an application of Codeigniter -- Created an function like
function searchUnivtab() {
$country = $this->input->post('countryKey');
$state = $this->input->post('stateKey');
$level = $this->input->post('level');
$degType = $this->input->post('degType');
$country = str_replace('%20', ' ', $country);
$state = str_replace('%20', ' ', $state);
$degType = explode('~', $degType);
$data = @$this->get->getSearchedUniversityTab($country, $state, $level, $degType[1]);
$html = '';
$i = 0;
foreach($data as $d)
{
$html .= '<option value="'.$d['name'].'">'.$d['name'].'</option>';
}
echo $html; die;
}
错误为: 遇到PHP错误
,严重性:警告
消息:为foreach()提供的参数无效行号:270
位于 foreach
行
Error as: A PHP Error was encountered
Severity: Warning
任何与上述代码相关的帮助?
Any help related to above code ?
推荐答案
function getSearchUniversity() {
country = jQuery('[name=countryKey]').val();
state = jQuery('[name=stateKey]').val();
level= jQuery('[name=level]').val();
degType= jQuery('[name=degType]').val();
jQuery.ajax({
type: "POST",
url:baseurl+ 'welcome/searchUnivtab',
cache: false,
data: {countryKey: country, stateKey: state, level: level, degType: degType},
error: function()
{
//notify('Error: Your request could be processed.. try again..!!');
},
success: function(html)
{
jQuery('[name=universityList]').html(html);
return false;
}
});
}
这篇关于消息:在CodeIgniter中为foreach提供的参数无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文