여분필드 글 수정시에 내용이 안보이는 현상
본문
글쓰기 페이지에서
<?php
$hp = explode("-",$write['wr_3']); //연락처
?>
<tr>
<td class="form3">연락처 (집/회사)</td>
<td class="form4">
<select name="hp_0" id="hp_0">
<option value='02' <?php echo ($write['hp_0'] == "02") ? "selected" : "";?>>02</option>
<option value='031' <?php echo ($write['hp_0'] == "031") ? "selected" : "";?>>031</option>
<option value='032' <?php echo ($write['hp_0'] == "032") ? "selected" : "";?>>032</option>
<option value='033' <?php echo ($write['hp_0'] == "033") ? "selected" : "";?>>033</option>
<option value='041' <?php echo ($write['hp_0'] == "041") ? "selected" : "";?>>041</option>
<option value='042' <?php echo ($write['hp_0'] == "042") ? "selected" : "";?>>042</option>
<option value='043' <?php echo ($write['hp_0'] == "043") ? "selected" : "";?>>043</option>
<option value='051' <?php echo ($write['hp_0'] == "051") ? "selected" : "";?>>051</option>
<option value='052' <?php echo ($write['hp_0'] == "052") ? "selected" : "";?>>052</option>
<option value='053' <?php echo ($write['hp_0'] == "053") ? "selected" : "";?>>053</option>
<option value='054' <?php echo ($write['hp_0'] == "054") ? "selected" : "";?>>054</option>
<option value='055' <?php echo ($write['hp_0'] == "055") ? "selected" : "";?>>055</option>
<option value='061' <?php echo ($write['hp_0'] == "061") ? "selected" : "";?>>061</option>
<option value='062' <?php echo ($write['hp_0'] == "062") ? "selected" : "";?>>062</option>
<option value='063' <?php echo ($write['hp_0'] == "063") ? "selected" : "";?>>063</option>
<option value='064' <?php echo ($write['hp_0'] == "064") ? "selected" : "";?>>064</option>
<option value='070' <?php echo ($write['hp_0'] == "070") ? "selected" : "";?>>070</option>
</select> -
<input type="text" name="hp_1" value="<?$write['hp_1']?>" class="frm_input" size="10" maxlength="4"> -
<input type="text" name="hp_2" value="<?$write['hp_2']?>" class="frm_input" size="10" maxlength="4"></td>
</tr>
연락처를 쪼갰는데요 뷰페이지이서는 입력된 내용이잘 보입니다. 수정시에 셀렉트 박스의 내용은 그대로 보여지는데
input박스의 내용은 사라져서 보이지 않습니다...
어떻게 해야할까요?
답변 2
$write['hp_0'] 은 $hp[0],
$write['hp_1'] 은 $hp[1],
$write['hp_2'] 은 $hp[2]
로 각각 수정해 보았으면 합니다. http://php.net/manual/kr/function.explode.php
디비 hp_1 hp_2 필드에 내용이잘들어가는지 확인해보세요
내용이 사라져서 안보이는거면 insert가 안되는거일수도있을꺼같은데요