여분필드사용하여 체크박스 관련
본문
프로그렘 문외한입니다.
상담게시판을 작업중인데 입력란이 많이 필요하여 여분필드를 60개 추가했습니다.(무식하면 용감하다는 말이 여기서 나온것 같습니다 ㅡㅡ;)
잘하시는 분들은 여분필드 몇개로도 해결하시리라 봅니다.. ㅡㅡ;
write.skin.php
<?
$wr_11 = explode("",$write['wr_11']);
$path1 = $wr_11[0];
$path2 = $wr_11[1];
$path3 = $wr_11[2];
$path4 = $wr_11[3];
$path5 = $wr_11[4];
$path6 = $wr_11[5];
$path7 = $wr_11[6];
$path8 = $wr_11[7];
$path9 = $wr_11[8];
?>
<label for="wr_11">신청경로<strong class="sound_only">신청경로</strong></label>
<input type=checkbox name="path1" value="동사무소" <? if($path1 == "동사무소") echo "checked"; ?>> 동사무소
<input type=checkbox name="path2" value="복지관" <? if($path2 == "복지관") echo "checked"; ?>> 복지관
<input type=checkbox name="path3" value="보건소" <? if($path3 == "보건소") echo "checked"; ?>> 보건소
<input type=checkbox name="path4" value="관리사무소" <? if($path4 == "관리사무소") echo "checked"; ?>> 관리사무소
<input type=checkbox name="path5" value="복지기관" <? if($path5 == "복지기관") echo "checked"; ?>> 복지기관
<input type=checkbox name="path6" value="시민사회단체" <? if($path6 == "시민사회단체") echo "checked"; ?>> 시민사회단체
<input type=checkbox name="path7" value="개인소개" <? if($path7 == "개인소개") echo "checked"; ?>> 개인소개: (<input type="text" name="wr_12" id="wr_12" class="frm_input " maxlength="20" value="<?=$write[wr_12]?>">)
write_update.skin.php 에
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
$sql2 = "update $write_table set
wr_12='$wr_12',
wr_13='$wr_13',
wr_14='$wr_14',
wr_15='$wr_15',
wr_16='$wr_16',
wr_18='$wr_18',
wr_19='$wr_19',
wr_20='$wr_20',
wr_21='$wr_21',
wr_22='$wr_22',
wr_23='$wr_23',
wr_24='$wr_24',
wr_25='$wr_25',
wr_26='$wr_26',
wr_27='$wr_27',
wr_28='$wr_28',
wr_29='$wr_29',
wr_30='$wr_30',
wr_31='$wr_31',
wr_32='$wr_32',
wr_33='$wr_33',
wr_34='$wr_34',
wr_35='$wr_35',
wr_36='$wr_36',
wr_37='$wr_37',
wr_38='$wr_38',
wr_39='$wr_39',
wr_40='$wr_40',
wr_41='$wr_41',
wr_42='$wr_42',
wr_43='$wr_43',
wr_44='$wr_44',
wr_45='$wr_45',
wr_46='$wr_46',
wr_47='$wr_47',
wr_48='$wr_48',
wr_49='$wr_49',
wr_50='$wr_50',
wr_52='$wr_52',
wr_53='$wr_53',
wr_54='$wr_54',
wr_55='$wr_55',
wr_56='$wr_56',
wr_57='$wr_57',
wr_59='$wr_59',
wr_60='$wr_60',
wr_61='$wr_61',
wr_62='$wr_62',
wr_63='$wr_63',
wr_64='$wr_64',
wr_65='$wr_65',
wr_67='$wr_67',
wr_68='$wr_68',
wr_69='$wr_69',
wr_70='$wr_70'
where wr_id='$wr_id'";
sql_query($sql2);
$wr_11 = "$path1|$path2|$path3|$path4|$path5|$path6|$path7|$path8|$path9";
$sql3 = " update $write_table set wr_11 = '$wr_11' where wr_id = '$wr_id' ";
sql_query($sql3);
$wr_17 = "$fatype1|$fatype2|$fatype3|$fatype4|$fatype5|$fatype6|$fatype7";
$sql4 = " update $write_table set wr_17 = '$wr_17' where wr_id = '$wr_id' ";
sql_query($sql4);
$wr_51 = "$chk1|$chk2|$chk3";
$sql5 = " update $write_table set wr_51 = '$wr_51' where wr_id = '$wr_id' ";
sql_query($sql5);
$wr_52 = "$litype1|$litype2|$litype3|$litype4";
$sql6 = " update $write_table set wr_52 = '$wr_52' where wr_id = '$wr_id' ";
sql_query($sql6);
$wr_58 = "$hotype1|$hotype2|$hotype3|$hotype4|$hotype5";
$sql7 = " update $write_table set wr_58 = '$wr_58' where wr_id = '$wr_id' ";
sql_query($sql7);
$wr_66 = "$req1|$req2|$req3|$req4";
$sql8 = " update $write_table set wr_66 = '$wr_66' where wr_id = '$wr_id' ";
sql_query($sql8);
if ($w == '')
alert('등록되었습니다.');
?>
체크박스 부분을 글쓰기하면 화면에 체크한 내용이 보이지만 수정에 들어가면 체크했던 내용이 없어져 있습니다. 도와주세요~
!-->!-->답변 2
$wr_11 = explode("",$write['wr_11']); 이부분이
$wr_11 = explode("|",$write['wr_11']); 가 되어야 하는거 아닌가요? ^^;
감사합니다. 그게 있어야 되는거군요.
그저 구분해주는 역할만 하는줄 알고 뺀거였는데..
다시한번 감사합니다.
답변을 작성하시기 전에 로그인 해주세요.