开发者

What would the conditional statement be to filter these inputs?

开发者 https://www.devze.com 2022-12-24 23:49 出处:网络
I have a page with a form, and on the form are a bunch of input check boxes. In the following page, there\'s the following code to process the inputs from the page before (which are set as an ID).

I have a page with a form, and on the form are a bunch of input check boxes. In the following page, there's the following code to process the inputs from the page before (which are set as an ID).

<? $field = $this->input->post('measure',true);
$totals = array();

    foreach($field as $value):
        $query = $this->db->get_where('items', array('id' => $value['input']))->row();

        $totals[] = $query->price; 
        ?>
    #HTML for displaying estimate output here
    <?php endforeach; ?>

How would I have the loop run conditionally only if there was a check o开发者_开发问答n the input on the page before?


Something like: if ($field == true) foreach(... should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消