<?php
if (isset($val))
{
foreach ($val as $va){?>
<?php echo $va['namehost'];?><br>
<?php }
}?>
public function mgetclinds($a,$b,$c,$d,$e,$f,$g,$h,$i,$j)
{
$array = array(
'state' => $f,
'city' => $g,
'area' => $h,
'cate' => $i,
'for' => $j
);
$this->db->like($array);
$query=$this->db->get($a,$b,$c,$d,$e);
return $query->result_array();
}?>
<?php //ON CONTROLLER//
public function extra1()
{
$dt['val'] = '';
if($this->input->post('submit'))
{
$selected1=$this->input->post('state');
$selected2=$this->input->post('city');
$selected3=$this->input->post('area');
$selected4=$this->input->post('cate');
$selected5=$this->input->post('for');
$dt['val']=$this->demomod->mgetclinds('reg',$selected1,$selected2,$selected3,$selected4,$selected5);
// echo "$selected1,$selected2,$selected3,$selected4,$selected5";
}
$this->load->view('extra1',$dt);
}
?>
http://php.net/manual/en/function.isset.php
In case you're new to PHP and want to get a foundation (necessary for working on PHP internals of CodeIgniter or any other framework) this article might help.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html