下拉依赖于php中的其他下拉列表

Hey friends I am trying to make two dropdown boxes. The first one is sensor type select. The second one is sensor names and it should be dependent on the first one .I am using MVC architecture.Here is my code I am using. At the viewpage.php I have:

<table>
        <td>
            <label><b>Sensors Types:</b></label>
        </td>
        <td>
            <?php echo form_dropdown('sensor_types', $sensor_types, '#', 'id="sensor_types"  onchange="copy();" ');?>
        </td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>
            <label><b>Sensor Name:</b></label>
        </td>
        <td>
            <?php echo form_dropdown('sensorzs', $sensorzs, '#', 'id="sensorzs"'); ?>
        </td>   
        </tr>
        </table>

and the code in the model.php is

function sensors_list($node_id) { 
        $this->db->select('sensor_index, sensor_name');
        $this->db->where('node_id', $node_id);
        //$this->db->where('sensor_type', $sensor_types);
        $this->db->order_by('sensor_index');                
        $query = $this->db->get('node_sensor_dtl');         

     }
function get_all_sensors($node_id) {
    $this->db->select('sensor_pk, sensor_name');
    $this->db->where('node_id', $node_id);
    $this->db->order_by('sensor_index');
    $query = $this->db->get('node_sensor_dtl');
    $sensors = array();
    if($query->result())
    {   
        $sensors[''] = '-Select-';  
        foreach ($query->result() as $sensor)
        {
            $sensors[$sensor->sensor_pk] = $sensor->sensor_name;
        }
        return $sensors;
    }
    else        {
        $sensors = NULL;
        return $sensors;
    }
}

and the code in the node.php the code is like this

function edit(){
    if($this->CI->input->post('editform_id') == NULL) redirect('configuration/node/');

    $view_data['page_title'] = "Node edit details";
    $view_data['page_name'] = "";
    $view_data['detail'] = $this->CI->model->get_node($this->CI->input->post('editform_id'));

    $view_data['sensor_types'] = $this->CI->model->get_all_sensor_types();
    $view_data['sensorzs'] = $this->CI->model->sensors_list($this->CI->input->post('editform_id'));
    $this->CI->load->view('config_node_view', $view_data);
}

I´ve tried this for past few days but could get the result. Searched lot of site and blogs but I can't get the required results.

if you are looking to create dropdown boxes, I believe you should not be creating a table, instead you need the select tag. I know this doesn't fully answer your question but I believe this should get you started. If your php code is producing the results you want, populate them into select tags and take it from there.