뷰화면 출력문제좀 도와주세요!!
본문
안녕하십니까?? 초보자 인사드립니다..
다름이 아니라 게시판을 연습하다가 출력에서 문제가 있어서 이렇게 글을 올립니다..
wirte.skin.php 와 view.skin.php 상단에
<?
$wr19 = explode("|",$write[wr_19]);
$select_pone = $wr19[0];
$tel2 = $wr19[1];
$tel3 = $wr19[2];
$tel4 = $wr19[3];
$tel5 = $wr19[4];
?>
이렇게 하였고
write_update.skin.php
$wr_19 = "$select_pone|$tel2|$tel3|$tel4|$tel5";
$sql19 = " update $write_table set wr_19 = '$wr_19' where wr_id = '$wr_id' ";
sql_query($sql19);
이렇게 추가하였습니다.
그리고
wirte.skin.php 에는
<select name="select_pone" id="pone" style="margin-left:15px; width:61px;height: 20px;float:left" class='ed' onChange="showSub(this.options[this.selectedIndex].value);">
<option value="1">휴대폰</option>
<option value="2">전화</option>
</select>
<select name="tel2 " id="tel2" style="margin-left:4px;width:43px;height: 20px;display: ;float:left" class='ed' itemname='휴대전화' required>
<option value='010' <? if($tel2 == "010") echo "selected";?>>010</option>
<!--<option value='011' <? if($write[wr_1] == "011") echo "selected"; ?>>011</option>
<option value='016' <? if($write[wr_1] == "016") echo "selected"; ?>>016</option>
<option value='017' <? if($write[wr_1] == "017") echo "selected"; ?>>017</option>
<option value='018' <? if($write[wr_1] == "018") echo "selected"; ?>>018</option>
<option value='019' <? if($write[wr_1] == "019") echo "selected"; ?>>019</option>-->
</select>
<select name="tel3 " id="tel3" style="margin-left:4px;width:43px;height: 20px;display: none;float:left" class='ed' itemname='전화' required>
<option value='02' <? if($tel3 == "02") echo "selected"; ?>>02</option>
<option value='031' <? if($tel3 == "031") echo "selected"; ?>>031</option>
<option value='032' <? if($tel3 == "016") echo "selected"; ?>>032</option>
<option value='041' <? if($tel3 == "017") echo "selected"; ?>>041</option>
<option value='042' <? if($tel3 == "018") echo "selected"; ?>>042</option>
<option value='043' <? if($tel3 == "019") echo "selected"; ?>>043</option>
</select>
이렇게 하였고
view.skin.php 에는
<td style="color:#767676;padding-left:15px;border-bottom:1px solid #ccc;">
<? if($select_pone =='1') { ?><? echo $tel2?><? } else { ?><? echo $tel3 ?><? } ?>-<?=$tel4?>-<?=$tel5?></td>
이렇게 하였습니다 뷰화면에 가서 보니
-9879-8979 이렇게만 나오드라고요...
이것저것 바꺼보고 했는데 문제를 잘 모르겠습니다..
조언좀 부탁드리겠습니다.(__)
답변 2
$wr_1_ar = explode(',', $wr_1);
<select name="wr_1_1" id="wr_1_1" style="margin-left:15px; width:61px;height: 20px;float:left" class='ed' >
<option value="">-선택-</option>
<option value="1">휴대폰</option>
<option value="2">전화</option>
</select>
<select name="wr_1_1" id="wr_1_2" style="margin-left:4px;width:43px;height: 20px;display: ;float:left" class='ed' itemname='전화' required>
</select>
<input type="text" name="wr_1_1" value="<?php echo $wr_1_ar[2] ?>">
<input type="text" name="wr_1_1" value="<?php echo $wr_1_ar[3] ?>">
<input type="hidden" name="wr_1" id="wr_1" value="<?php ?>">
<script>
var tel = { 1: ['010', '011'], 2: ['02', '031', '053'] };
$( '#wr_1_1' ).on('change', function() {
var html = '';
for (var i in tel[this.value])
html += '<option value"' + tel[this.value][i] + '">' + tel[this.value][i] + '</option>';
$( '#wr_1_2' ).html(html);
});
$( '#wr_1_1' ).val('<?php echo $wr_1_ar[0] ?>').trigger('change');
$( '#wr_1_2' ).val('<?php echo $wr_1_ar[1] ?>');
$( '[name=wr_1_1]' ).on('keyup change', function() {
var val = '';
$( '[name=wr_1_1]' ).each( function() {
val += this.value + ',';
});
$( '#wr_1' ).val( val.replace(/,$/, '') );
});
</script>
$wr_19 = "$select_pone|$tel2|$tel3|$tel4|$tel5";
$sql19 = " update $write_table set wr_19 = '$wr_19' where wr_id = '$wr_id' ";
>>>>>>> 다음과 같은 내용을 추가해서 쿼리가 어떻게 입력이 되는지 확인하세요
echo $sql19;
sql_query($sql19);