gundambison

perbaikan50

Feb 6th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /*
  4.  * To change this license header, choose License Headers in Project Properties.
  5.  * To change this template file, choose Tools | Templates
  6.  * and open the template in the editor.
  7.  */
  8.  
  9.   function polling_detail($id = NULL) {
  10.     //echo "here";
  11.     //print_r($_POST);DIE;
  12.     $t['title'] = 'Polling Media Indonesia | Refrensi Indonesia';
  13.     $data['polling_detail'] = $t['title'];
  14.  
  15.  
  16.     //$this->output->enable_profiler(TRUE);
  17.     $this->load->model('data', 'polling_detail');
  18.     $this->load->helper('analytics');
  19.     $this->output->cache(10);
  20.  
  21.     //$t['rows']        = $this->model_utama->polling_sum($row['id'])->row_array();
  22.     //$t['polling']     = $this->model_utama->polling();
  23.     //$t['id']          = $this->polling_detail->polling_sum($row['id'])->row_array();
  24.     $t['polling'] = $this->polling_detail->all_polling();
  25.     echo "post:<pre>";
  26.     print_r($_POST);
  27.     echo "</pre>";
  28.     //DIE;
  29.  
  30.     /*
  31.       cek apakah ada post masuk
  32.  
  33.      */
  34.     if ($this->input->post('poll')) {
  35.         if ($id !== NULL) {
  36.             die('error no id send');
  37.         }
  38.         $poll = $this->input->post('poll'); //POLL
  39.         //echo($poll);
  40.         //die;
  41.         //$poll = $this->input->post('id');//ambil IP
  42.         //echo($poll);die;
  43.         foreach ($poll as $id_poll => $row) {
  44.            
  45.             $ip = '123123'; // silakan ganti dgn fungsi yg bs dapetin IP
  46.             $choose = $row;
  47.             $data=array(
  48.                 'ip'=>$ip,
  49.                 'choose'=>$choose,
  50.                 'poll_id'=>$id_poll
  51.             );
  52.            
  53.             $this->db->insert('poll',$data);
  54.  
  55.             $t['polling_detail'] = $this->polling_detail->polling_sum($id);
  56.             echo "<pre>";
  57.             print_r($t['polling_detail']);
  58.             echo "</pre>";
  59.  
  60.            
  61.         }
  62.         //cek apakah ada data yg masuk
  63.         die('stop');
  64.         redirect("home/polling_detail/" . $id);
  65.     }
  66.     $t['polling_detail'] = $this->polling_detail->polling_sum($id);
  67.  
  68.  
  69.     //die('ha');
  70.     #Menu
  71.    $t['v_menu'] = $this->load->view('template/v_menu', NULL, TRUE);
  72.     #Footer
  73.    $t['v_footer'] = $this->load->view('template/v_footer', NULL, TRUE);
  74.     #Analytic
  75.    $t['analytics'] = google();
  76.     #Revive
  77.    $t['revive'] = revive();
  78.     $page = $this->load->view('read/v_detail_polling', $t, FALSE);
  79. }
Advertisement
Add Comment
Please, Sign In to add comment