duanhe6799 2016-07-17 07:19
浏览 62
已采纳

严重性:警告消息:为foreach()提供的参数无效文件名:helpers / form_helper.php

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>
  • 写回答

2条回答 默认 最新

  • duandushang5148 2016-07-17 07:31
    关注

    You problem lies in form_helper.php means this line of code calling it.

    echo form_dropdown('localidad', '', '', 'class="localidad" id="localidad"');
    

    Now this function form_dropdown expect one parameter to be an array. It could be 2nd or third. Make sure you have read documentation to this function.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿