Question: There is problem with Query :

```
$outputs = rosy, rosmary; //array1

$filenames =2.2, 3.2; // array 2

```

Query:

```
$insert_col  = "UPDATE `lil` SET `D`='" .$output. "' WHERE `A`= '" .$filename. "'";// does not work

```

Instead of the arrays when i give single value, it works very fine, like :

```
$insert_col  = "UPDATE `lil` SET `D`='rosy' WHERE `A`= '2.2'"; // it works

```

for taking two arrays into the query i have written foreach loop, as follows

```
foreach (array_combine($outputs, $filenames) as $output => $filename) {
    $insert_col = "UPDATE `4` SET `D`='" . $output . "' WHERE `A`= '" . $filename . "'";
    echo $insert_col;
}

```

Please Help !!

Answer: 
if I dont get you wrong, You are asking something like this;

In controller;

```
public function get_categories()
{
    if(isset($_POST) && !empty($_POST())
    {

        $id = $this->input->post('selectCatsByComponent');

        // bla bla bla

        $data['id'] = $id;
        $this->load->view('whatever/whatever',$data);
    }
    else
    {
        //Your normal page before posting
    }
}

```

Now you can access the id value in **view** like this

```
if(isset($id)) // if there is a $id loaded
{
    // Your view accoring to $id
}

```

Note: I did not have an test environment while I was writing this code. So The code is not complate and there might be some mistakes
```
You can use ajax with jquery onchange function, see the below example:
$("#bussiness").live('change',function(){
    var bus_id=$(this).val();
    $.ajax({
        url : "<?php echo base_url(); ?>setting/set_session/"+bus_id,
        success:function(res) {
            document.getElementById('output').HTML = res;
        }           
    });

});

```