I have an array that saves the values from a counter and I want to send that array to my controller to open another view.
for example I'm in main_view.php in my views folder... within my main_view.php I have a counter and a array that increase with data when something happens.
$counter = 0;
$arr = array();
foreach($value->result as $val){}
if($val->somethinghappenedtrue){
$counter++;
$arr[] = array('data' => $thethingthathappened);
}
}
$array_encoded = json_encode($arr);
then in my anchor I have:
anchor('controller/method/'.$array_encoded ,'Counter:: '.$counter, array('title'=>'ARRAY SENT'))
and in my view that I want to open with the anchor i have
controller{
method($array_encoded){
$array_decoded = json_decode($array_encoded);
echo '<pre>';
print_r($array_decoded);
echo '</pre>';
$this->load->view('other_view');
}
}
but it does not work it gives me:
Severity: NoticeMessage: Undefined variable: $array_encoded