0
I am trying to pass on the value of Id_company in my href select, but without success. Can someone please direct me? This is my href:
<div class="box-footer clearfix">
<a href="<?=site_url('dashboard/financeiros/excelFinanceiro?empresa=[document.getElementById("empresa").value]')?>" class="btn btn-sm bg-blackzag btn-flat pull-left">Gerar Excel</a>
</div>
I’m trying to capture the company id that’s on this view. He is declared in some points.
<h4>FILTRAR:</h4>
</div>
<div class="col-lg-3 col-xs-12">
<div class="form-group">
<select class="form-control select2" id="empresa" style="width: 100%;" onchange="funcFiltra(1);">
<option value="0" selected="selected">Empresa</option>
<?php foreach($empresas as $v):?>
<option value="<?=$v->getEmpresasId()?>"><?=$v->getNome()?></option>
<?php endforeach;?>
<option value="0">Todos</option>
</select>
</div>
</div>
And there’s this Function that makes the filter:
<script>
funcCarregaCombo();
function funcCarregaCombo() {
document.getElementById("empresa").value = <?php echo $_SESSION['ID_EMPRESA']; ?>;
}
function funcFiltra(opcao) {
var idItem = opcao;
var idIndex = "";
switch(opcao) {
case 1:
idIndex = document.getElementById("empresa").value;
break;
case 2:
idIndex = document.getElementById("data").selectedIndex;
// Selecionado TODOS - ComboBox Tempo
if (idIndex == 0) {
location.href = site_url+'dashboard/financeiros/relatorio/';
}
break;
default:
break;
}
//alert("idItem = " + idItem);
//alert("idIndex = " + idIndex);
if ((idItem != null) || (idItem != "")) {
location.href = site_url+'dashboard/financeiros/filtro/'+idItem+'/'+idIndex;
}
}
</script>
I don’t understand, id will be passed on href is this?
– Anderson Henrique
That. When I do so with fixed value it works: <a href="<?= site_url('Dashboard/financial/excelFinanceiro???' company=12')? >" class="btn btn-Sm bg-blackzag btn-flat pull-left">Generate Excel</a> .
– Mauricio3012