过滤这些输入的条件语句是什么?

时间:2010-03-26 18:13:53

标签: php html checkbox

我有一个带有表单的页面,并且在表单上有一堆输入复选框。在下一页中,有以下代码用于处理之前页面的输入(设置为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; ?>

如果之前检查过页面上的输入,我将如何有条件地运行循环?

1 个答案:

答案 0 :(得分:1)

类似于:if ($field == true) foreach( ......应该有用。