셀렉트 박스 관련 질문입니다. 채택완료
그누보드로 홈페이지를 하나 제작하고 있습니다.
위에 그림 처럼 셀렉트 박스에서 하나를 선택하고 밑에 값을 입력하면 DB에 입력되어야 합니다.
이렇게 하나는 입력이 되지만.. 셀렉트박스에 36이 아닌 것을 선택하면 밑에 값을 입력하는 곳에
그 전에 입력된 값이 그대로 입력되어 있습니다.
저는 셀렉트 박스에서 다른 내용에 카테고리를 선택할때마다 다 다르게 값들이 그 카테고리에 맞게
저장 되어 db에 입력하고 싶은데 ...
이것저것 써봐도 익숙하지가 않아서 좀 어렵네요

이 사진은 DB값입니다.
저는 일단 하나씩만 만들었는데 하면서 ..여러값을 받을 수 있게 레코드를 더 작성해야하는지
궁금합니다.
마지막으로 소스는..
<tr>
<th scope="row"><label for="it_band_type">숫자 유형</label></th>
<td >
<?php echo help("선택 할 수있습니다."); ?>
<span onChange="skt2(this.value)">
<select name="it_band_type" id="it_band_type">
<option value="0"<?php echo get_selected('0', $it['it_band_type']); ?>>선택</option>
<option value="1"<?php echo get_selected('1', $it['it_band_type']); ?>>29</option>
<option value="2"<?php echo get_selected('2', $it['it_band_type']); ?>>36</option>
<option value="3"<?php echo get_selected('3', $it['it_band_type']); ?>>42</option>
<option value="4"<?php echo get_selected('4', $it['it_band_type']); ?>>47</option>
<option value="5"<?php echo get_selected('5', $it['it_band_type']); ?>>51</option>
<option value="6"<?php echo get_selected('6', $it['it_band_type']); ?>> 59</option>
<option value="7"<?php echo get_selected('7', $it['it_band_type']); ?>> 69</option>
<option value="8"<?php echo get_selected('8', $it['it_band_type']); ?>> 80</option>
<option value="9"<?php echo get_selected('9', $it['it_band_type']); ?>> 100</option>
</select>
</span>
<script>
$(function() {
$("#it_band_type").change(function() {
if(parseInt($(this).val()) > 0)
$("#it_band_unit").text("원");
else
$("#it_band_unit").text("원");
});
});
</script>
</td>
<td class="td_grpset">
<input type="checkbox" name="chk_ca_it_band_type" value="1" id="chk_ca_it_band_type">
<label for="chk_ca_it_band_type">분류적용</label>
<input type="checkbox" name="chk_all_it_band_type" value="1" id="chk_all_it_band_type">
<label for="chk_all_it_band_type">전체적용</label>
</td>
</tr>
<script>
function skt2(v){
var a;
var b;
var c;
switch(v){
case '1' : a = 143000; break;
case '2' : a = 12213; break;
case '3' : a = break;
case '4' : a = break;
default : a = 0; break;
}
document.getElementById("hhh").innerHTML = a;
}
</script>
<tr>
<th scope="row"><label for="it_tband_type">값을 받는 폼</label></th>
<td>
<?php echo help("값을 입력 "); ?>
<input type="text" name="it_tband_type" value="<?php echo $it['it_tband_type']; ?>" id="it_tband_type" class="frm_input" size="8"> <span id="it_band_unit" id="hhh"><?php if($it['it_band_type']) echo '원'; else echo '원'; ?></span>
</td>
<td class="td_grpset">
<input type="checkbox" name="chk_ca_it_tband_type" value="1" id="chk_ca_it_tband_type">
<label for="chk_ca_it_tband_type">분류적용</label>
<input type="checkbox" name="chk_all_it_tband_type" value="1" id="chk_all_it_tband_type">
<label for="chk_all_it_tband_type">전체적용</label>
</td>
</tr>
이건데 음...어떤 식으로 진행을 해야 할까요?
고수님들 부탁드립니다.
답변 1개
<option value="">선택</option>
<option value="29"<?php echo get_selected('29', $it['it_band_type']); ?>>29</option>
<option value="36"<?php echo get_selected('36', $it['it_band_type']); ?>>36</option>
<option value="42"<?php echo get_selected('42', $it['it_band_type']); ?>>42</option>
<option value="47"<?php echo get_selected('47', $it['it_band_type']); ?>>47</option>
<option value="51"<?php echo get_selected('51', $it['it_band_type']); ?>>51</option>
<option value="59"<?php echo get_selected('59', $it['it_band_type']); ?>> 59</option>
<option value="69"<?php echo get_selected('69', $it['it_band_type']); ?>> 69</option>
<option value="80"<?php echo get_selected('80', $it['it_band_type']); ?>> 80</option>
<option value="100"<?php echo get_selected('100', $it['it_band_type']); ?>> 100</option>
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인