You can apdatar this code for your use:
<select class="input-xxlarge empresaRegistro" name="empresaRegistro" id="empresaRegistro" style="width: 715px !important;" onChange="getFuncionario()">
<option value="">Selecione a Empresa</option>
<?
foreach($lista_cedente as $valor){
?>
<option value="<? echo $valor->idCedente; ?>"><? echo $valor->razaosocial; ?></option>
<? } ?>
</select>
jQuery script:
<script>
function getFuncionario() {
var id = $('#empresaRegistro').val();
$(".idFuncionarioLista").append('<option value="0">Carregando...</option>');
$.post("<? echo base_url(''); ?>proventos/ajax/funcionario/"+id,
{idFuncionarioLista:jQuery(id).val()},
function(valor){
$(".idFuncionarioLista").html(valor);
}
);
}
</script>
In this scheme: When you select the Registration Company (field CompanyRegistration), I enter through ajax and search all the data and ready them underneath in a next select field also called idFuncionarioLista. You can do the same type of jquery to fetch the next select, then use onchange="NOMEDAFUNCAO ()" in the select idFuntionaryList for example.