#66 에따른 코드를 db 접속 횟수를 줄위기 위해 코드 재수정

This commit is contained in:
chicpro
2013-04-12 18:03:08 +09:00
parent f6a45b08fb
commit 3769d130c8
2 changed files with 18 additions and 17 deletions

View File

@ -621,24 +621,13 @@ function alert_opener($msg='', $url='')
exit;
}
// 배송회사를 select 로 출력
function print_delivery_company($no, $val)
// option 리스트에 selected 추가
function conv_selected_option($options, $value)
{
global $g4;
if(!$options)
return '';
$delivery_options = '';
$sql = " select * from {$g4['shop_delivery_table']} order by dl_order ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
$selected = get_selected($row['dl_id'], $val);
$delivery_options .= '<option value="'.$row['dl_id'].'"'.$selected.'>'.$row['dl_company'].'</option>'.PHP_EOL;
}
$str = '<label for="dl_id_'.$no.'">배송업체</label>'.PHP_EOL;
$str .= '<select name="dl_id['.$no.']" id="dl_id_'.$no.'">'.PHP_EOL;
$str .= '<option value="">선택하세요</option>'.PHP_EOL;
$str .= $delivery_options;
$str .= '</select>';
$str = str_replace('value="'.$value.'"', 'value="'.$value.'" selected="selected"', $options);
return $str;
}