다중 셀렉트(배열이용)
<?
$Test1Array = array("셀렉트1_1","셀렉트1_2","셀렉트1_3","셀렉트1_4");
$Test2Array = array("셀렉트2_1","셀렉트2_2","셀렉트2_3","셀렉트2_4");
?>
<!-- 카테고리별 상세검색 시작 -->
<form name=cat_form method='get' >
<input type="hidden" name="table" value="<?=$table?>">
<table width="745" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" bgcolor="efefef"><table width="715" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="21" style="padding:0 0 2px 0"><img src="../images/btn/top_blet.gif" width="11" height="11"></td>
<td width="160" class="category" style="padding:2px 0 0 0">카테고리별 상세 검색</td>
<td width="172">
<select name=category1 style="width:160px;border:1px solid #C8C8C8;font-family:돋움;font-size:9pt;padding:2px;">
<option value="" selected>:: 셀렉트1 ::</option>
<? foreach($Test1Array as $v){
$selected = (ereg($v, $category1)) ? "selected" : "";
echo "<option value='".$v."' ".$selected.">".$v."</option>";
}?>
</select>
</td>
<td width="169">
<select name=category2 style="width:160px;border:1px solid #C8C8C8;font-family:돋움;font-size:9pt;padding:2px;">
<option value="" selected>:: 셀렉트2 ::</option>
<? foreach($Test2Array as $v){
$selected = (ereg($v, $category2)) ? "selected" : "";
echo "<option value='".$v."' ".$selected.">".$v."</option>";
}?>
</select>
</td>
<td width="193"><input type="image" src="../images/btn/top_search.gif" width="37" height="21"></td>
</tr>
</table></td>
</tr>
</table>
</form>
<!-- 카테고리별 상세검색 끝 -->
배열에만 요소를 추가하면 자동으로 option 이 추가됨