My problem is this. The dashboard of my project has an input where the user enters the process number and clicks to search, as per the code below:
<form class="navbar-form navbar-left" role="search" action="<?= base_url() ?>processo/pesquisar" method="post">
<div class="form-group">
<input type="text" style="width: 250px;" name="pesquisar" class="form-control" placeholder="Digite o número do processo" required>
<button type="submit" class="btn btn-default btn-md"> CONSULTAR</button>
</div>
</form>
When I click Search, I call the Processor search method of the Process, as below, which calls the get_processos_like method of the model, Process_model:
public function pesquisar() {
$this->load->model('Processo_model', 'processo');
$dados['processo'] = $this->processo->get_processos_like();
if (!$this->processo->get_processos_like()) {
$data["msg"] = "Processo não encontrado.";
$this->load->view('includes/msg_erro', $data);
} else {
$this->load->view('/listar/listar_processo_adv', $dados);
}
}
#Método get_processos_like do Model:
function get_processos_like() {
$termo = $this->input->post('pesquisar');
$this->db->select('*');
$this->db->where('nprocesso', $termo);
return $this->db->get('processo')->result();
}
This method returns the data of the searched process to view list_processos_adv.php, which displays all the process information and has a link calling another view, as below:
<div class="row">
<div align="center">
<button type="button" title="Detalhes" onclick="window.location.href = '<?= base_url('processo/custas')?>'" class="btn btn-primary>INFORMAÇÕES DE CUSTAS</button>
</div>
</div>