2014-02-23 6 views
0

안녕하세요 친구를 삭제 채우는하지만 직접 오는 해결할 수없는 메신저 문제 ...CodeIgniter는 .... 데이터베이스에서 아래로 미세하게 작동하고 을 내가 CodeIgniter의 문제가 드롭 다운 목록 데

이있다 코드가 여기 내 * 모드 * 리터 ..

function getBatchId(){ 

$batchId = $this->db->get('batch'); 


$batchList = array(); 

if($batchId->num_rows() >0){ 

foreach ($batchId->result_array() as $tablerow) { 
    $batchList[] = $tablerow['code']; 
} 

return $batchList; 


}else {return false;} 

컨트롤러

$this->load->model('AdmissonModel'); 

$content = array(
'progid' => $this->AdmissonModel->getProgrameCode(), 
'batch' => $this->AdmissonModel->getBatchId(), 
'depid' => $this->AdmissonModel->getDepId() 
     ); 



$this->load->view('Admissions/admForm_view',$content); 

내보기

<tr> 
<td>BATCH</td> 
    <td><?php echo form_dropdown('Batch',$batch); ?></td> 
</tr> 

생산 결과 이제 문제는 내가 BCS12, BCS14, IMS01 등을하지 0,1,2처럼 또한 값을 원하는 것입니다이

<select name="Batch"> 
<option value="0">BCS12</option> 
<option value="1">BCS14</option> 
<option value="2">IMS01</option> 
<option value="3">INU01</option> 
<option value="4">INU02</option> 
<option value="5">INU03</option> 
</select> 

같다 3 개 ...하지만 값은 ..... 0,1,2,3,4 있습니다 할 수있는 1 도움 나 PLZ ... 모델 업데이트에서 많이 미리

답변

0

에 감사이 기능

function getBatchId(){ 

$batchId = $this->db->get('batch'); 


$batchList = array(); 

if($batchId->num_rows() >0){ 

foreach ($batchId->result_array() as $tablerow) { 
    $batchList[$tablerow['code']] = $tablerow['code']; 
} 

return $batchList; 


}else {return false;}