View difference between Paste ID: wqBPrwdz and Hzapt09B
SHOW: | | - or go back to the newest paste.
1
<?php
2
3
class Home extends CI_Controller {
4
5
    public function __construct() {
6
        parent::__construct();
7
        $this->load->model('Kriteria_model');
8
    }
9
10
    public function index() {
11
    	if($_SERVER['REQUEST_METHOD'] == "POST"){
12-
        $jml_kriteria = $this->Kriteria_model->jml();
12+
        	$jml_kriteria = $this->input->post('iKriteria'); //$this->Kriteria_model->jml();
13-
    		for ($i=1; $i = $jml_kriteria; $i++) { 
13+
    		for ($i=1; $i <= $jml_kriteria; $i++) { 
14-
    			$data['nilai'] = $this->input->post($i);
14+
    			$data['nilai'][] = $this->input->post('var_'.$i); // $this->input->post($i);
15
    		}
16
    	}
17
        $data['kriteria'] = $this->Kriteria_model->get_all();
18
        $data['title'] = 'Home';
19
        $data['contents'] = 'front/home';
20
        $this->load->view('front/layout/template', $data);
21
    }  
22
}