I have a dynamic select ? which carries the values in another select . Charging is running . However displays this Message:
Severity: Warning Message: Invalid argument supplied for foreach() Filename: helpers/form_helper.php
This is my controller:
public function getparcelas()
{ if($this->input->post('aquiller'))
{
$parcelas = $this->input->post('aquiller');
$localidades = $this->sindico->get_parcelas($parcelas);
foreach($localidades as $fila)
{
?>
<option value="<?=$fila->numero_parcelas ?>"><?=$fila->numero_parcelas ?></option>
<?php
}
}
}}
My view : This is my view
$dados['album'] = $this->sindico->get_aquiller();
echo "<select name='aquiller' id='aquiller' class='form-control input-sm'>";
if (count($dados['album'])) {
foreach ($dados['album'] as $list) {
echo "<option value='". $list['id_alug'] . "'>" . $list['numero_apart'] . "-" . $list['nome_usu'] . "</option>";
}
}
echo "</select>";
echo form_dropdown('localidad', '', '', 'class="localidad" id="localidad"');
This is my javascript:
<script type="text/javascript">
$(document).ready(function() {
$("#somar").click(function(){
var total = 0;
$('.input').each(function(){
var valor = Number($(this).val());
if (!isNaN(valor)) total += valor;
});
$(".resultado").val(total.toFixed(2));
});
});
</script>
<script>
function calcular(){
var dt1 = document.getElementById("dt1").value;
var dt2 = document.getElementById("dt2").value;
var data1 = new Date(dt1);
var data2 = new Date(new Date(dt2));
var total = (data2.getFullYear() - data1.getFullYear())*12 + (data2.getMonth() - data1.getMonth());
document.getElementById("result").value = total;
}
</script>