3단 셀렉트 AJAX로 수정
본문
현재 아래 3단 셀렉트 소스를 새로고침 없는 AJAX 방식으로 수정 하려합니다.
도움 부탁드립니다~
<select name="ca_name" value="<?php echo $write['ca_name'] ?>" id="ca_name" onchange="option1();">
<option value="">선택하세요</option>
<?php
$sql2 = "SELECT DISTINCT * FROM g5_write_online1 where wr_6 < now() and wr_7 > now() group by ca_name";
$result2 = sql_query($sql2);
while($data1 = sql_fetch_array($result2)) {
?>
<option value="<?=$data1['ca_name']?>" <? if($data1['ca_name']==$ca_name) echo " selected ";?>> <?=$data1['ca_name']?></option>
<?php } ?>
</select>
<select name="wr_3" value="<?php echo $write['wr_3'] ?>" onchange="option2();" />
<option value="">선택하세요</option>
<?php
$sql2 = "SELECT DISTINCT * FROM g5_write_online1 WHERE wr_6 < now() and wr_7 > now() and ca_name = '$ca_name' group by wr_3";
$result2 = sql_query($sql2);
while($data1 = sql_fetch_array($result2)) {
?>
<option value="<?=$data1['wr_3']; ?>" <? if($data1['wr_3']==$wr_3) echo " selected ";?>><?=$data1['wr_3']; ?></option>
<?php } ?>
</select>
<select name="wr_4" value="<?php echo $write['wr_4'] ?>" onchange="option3();" />
<option value="">선택하세요</option>
<?php
$sql2 = "SELECT DISTINCT * FROM g5_write_online1 WHERE ca_name = '$ca_name' and wr_3 = '$wr_3' group by wr_4";
$result2 = sql_query($sql2);
while($data1 = sql_fetch_array($result2)) {
$write['wr_1'] = $data1['wr_num'];
?>
<option value="<?=$data1['wr_4']; ?>" <? if($data1['wr_4']==$wr_4) echo " selected ";?>><?=$data1['wr_4']; ?></option>
<?php } ?>
</select>