CI 코드

제목 [예제] 입력클래스 배열처리시
글쓴이 ci세상 작성시각 2009/09/08 11:34:07
댓글 : 0 추천 : 0 스크랩 : 0 조회수 : 14593   RSS

사용목적 : 배열값을 뷰에서 넘겨서 컨트롤러에서 받을경우 사용

#### view ###
<input type="checkbox" name="chkNo[]" value="<?=$row->idx?>">

#### 컨트롤러 ###

  if($this->input->post('chkNo'))
  {
   $chk_total = count($this->input->post('chkNo'));
  } else {
   $chk_total = 0;
  }
  
  if($chk_total > 0)
  {
   $chkArray = $this->input->post('chkNo');
   
   for($i=0; $i<$chk_total; $i++){

    echo $chkArray[$i];
    echo "<br>";

   }
  }



<keypoint>
$chkArray = $this->input->post('chkNo'); 로 값을 받아서 처리


참조메뉴얼 : http://codeigniter-kr.org/user_guide/libraries/input.html

keypoint 참조 : http://codeigniter.com/forums/viewthread/102264/
 


 다음글 [코어확장] 프로파일러 세션추가 (1)
 이전글 matchbox 적용된 CI 1.7.1 버전 (3)

댓글

없음