채택완료

체크한것을 필드 안에 넣으려 하거든요.. 도와주세요.

2014-12-05 (금) 18:14:04 4,509

wirte.skin.php에서 아래와 같이 체크박스를 하게 어떤 고마우신 분이 만들어 주셨어요..

<tr>
</tr>
    <td>
  <input type="checkbox" name="rweekd[]" id="rweekd0" value="0" /><label for="rweekd0"><span style="color:red"><B>일,</B></span></label>&nbsp;
  <input type="checkbox" name="rweekd[]" id="rweekd1" value="1" /><label for="rweekd1"><B>월,</B></label>&nbsp;
  <input type="checkbox" name="rweekd[]" id="rweekd2" value="2" /><label for="rweekd2"><B>화,</B></label>&nbsp;
  <input type="checkbox" name="rweekd[]" id="rweekd3" value="3" /><label for="rweekd3"><B>수,</B></label>&nbsp;
  <input type="checkbox" name="rweekd[]" id="rweekd4" value="4" /><label for="rweekd4"><B>목,</B></label>&nbsp;
  <input type="checkbox" name="rweekd[]" id="rweekd5" value="5" /><label for="rweekd5"><B>금,</B></label>&nbsp;
  <input type="checkbox" name="rweekd[]" id="rweekd6" value="6" /><label for="rweekd6"><span style="color:blue"><B>토</B></span></label>
 </td>
</tr>​

체크는 한가지가 아니라 모두 다 할 수도 잇거든요..

어떤걸 어떤걸 체크했는지 wr_10 에 구분자 |로 구분하여 입력시키고 싶어요...

그러면 write_update.php 파일에 어떻게 해야 하는지 좀 갈켜주세요...

 $arr_weekday = $_POST['rweekd'];

|

답변 4개

채택된 답변
+20 포인트
2014-12-05 (금) 18:29:27

$arr_weekday = implode("|", $_POST['rweekd']);

이렇게 코딩해 보세요. 

2014-12-05 (금) 19:03:51

신게이츠님 대단히 고맙습니다.. 미쳐 채택을 못해드렸네요... 죄송합니다..ㅠ 

2014-12-05 (금) 19:00:38

답변주신분들 대단히 감사드립니다. 

2014-12-05 (금) 18:49:12

<?

$r_weekday = $_POST['rweekd'];

$TMP_CNT = count($r_weekday);

for($i=0;$i<$TMP_CNT;$i++){

$n = $r_weekday[$i];

switch($n){

case '1':

$s="월";

break;

case '2':

$s="화";

break;

case '3':

$s="수";

break;

case '4':

$s="목";

break;

case '5':

$s="금";

break;

case '6':

$s="토";

break;

case '0':

$s="일";

break;

}

$t .= $s."|";

}

//

여기에 DB입력 쿼리 넣으시면 될듯 -> wr_10 = $t

//

?> 

답변을 작성하려면 로그인이 필요합니다.