[eluser]Unknown[/eluser]
Hello Everybody,
I have download the new version of codeigniter and it give me following error when I use set_value() for getting array in return.
ERROR
------
Warning (in_array() expects parameter 2 to be array, string given in file: views/add_role_view.php on line: 123)
Actually my task is to set the checked values of checkboxes after postback.
Have a look my code.
Code:
<?php
$page_id = array();
$page_id = set_value('assignRole[]');
foreach($data as $row){
?>
<input type="checkbox" value="<?php echo($row->page_id); ?>" name="assignRole[]" <?php if(!empty($page_id) && in_array($row->page_id, $page_id)){?>checked="checked" <?php }?> />
<?php
}
?>
$row->page_id is a unique ID coming from loop send by controller in $data variable.
It was working fine in previous version i.e. 1.7.3 but when I installed the new version it going to mass.
By the way I am using version 2.1.2
Any idea??