更改复选框以选择框

时间:2013-05-17 15:00:56

标签: php javascript drop-down-menu

我有这个:

<?php foreach($characteristic_displayfields as $ch_id){?>   

        <?php if (is_array($characteristic_fieldvalues[$ch_id])){?>

            <div class="characteristic_name"><?php print $characteristic_fields[$ch_id]->name;?></div>

            <input type="hidden" name="extra_fields[<?php print $ch_id?>][]" value="0" />            

            <?php foreach($characteristic_fieldvalues[$ch_id] as $val_id=>$val_name){?>

                <input type="checkbox" name="extra_fields[<?php print $ch_id?>][]" value="<?php print $val_id;?>" <?php if (is_array($extra_fields_active[$ch_id]) && in_array($val_id, $extra_fields_active[$ch_id])) print "checked";?> onclick="document.jshop_filters.submit();" /> <?php print $val_name;?><br/>

            <?php }?>

        <br/>

        <?php }?>

    <?php }?>

我想将其转换为选择框。

我试过了:

<?php foreach($characteristic_displayfields as $ch_id){?>   

        <?php if (is_array($characteristic_fieldvalues[$ch_id])){?>

        <div class="characteristic_name"><?php print $characteristic_fields[$ch_id]->name;?></div>
        <select name="something" class="extra_fields[<?php print $ch_id?>][]" title="something something" onchange="document.jshop_filters.submit();">   

            <?php foreach($characteristic_fieldvalues[$ch_id] as $val_id=>$val_name){?>

                <option value="<?php print $val_id;?>" > <?php print $val_name;?></option>

            <?php }?>

        </select>

        <?php }?>

    <?php }?>

一切看起来都很好,但是从选择框中选择一个值后,它必须显示具有所选值的产品,页面刷新,但结果是相同的。

0 个答案:

没有答案