<form id="giftEditFrom">
    <input type="hidden" name="order_id" value="<?php echo $order_info->id; ?>">
    <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="x`table">
        <tr>
            <?php
            $index = 0;
            foreach($gift_group_items as $item) {
                if($index > 0 && $index%4==0) {
                    echo '</tr><tr>';
                }
                $index++;
                $sel_gift = isset($sel_gifts[$item->id])?$sel_gifts[$item->id]->gift:null;
                echo '<td width="85" class="bg_tr">'.$item->name.'</td>';
                echo '<td class="td_bg">';
                echo '<select class="gifts" min="'.$item->min_money.'" max="'.$item->max_money.'" name="gifts[]" is_damage="'.$item->is_damage.'" style="width:132px;"';
                if($item->min_money > 0 )
                    echo ' disabled ';
//                                                if($sel_gift != null && $sel_gifts[$item->id]->status == 1)
//                                                    echo ' readonly ';
//                                                echo '>';
                if($sel_gift != null)
                    echo ' disabled ';
                echo '>';
                echo '<option value="0"></option>';
                foreach($item->gifts as $gift) {
                    echo '<option value="'.$item->id.'_'.$gift->id.'"';
                    if($sel_gift != null && $sel_gift->id == $gift->id) {
                        echo ' selected ';
                    }
                    echo '>'.$gift->name.'</option>';
                }
                echo '</select>';
                echo '</td>';
            }
            while($index%4!=0) {
                echo '<td width="85" class="bg_tr"></td>';
                echo '<td class="td_bg"></td>';
                $index++;
            }
            ?>
        </tr>
    </table>
</form>
