emprit

control-view

Dec 3rd, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. ------------------Controller--------------------
  2. function administrasi() {
  3.         if($this->session->userdata('sudah_login_pelamar')){
  4.             $isi['query'] = $this->kriteria_model->lihat();
  5.             $array = array( 'content' => $this->load->view('akun_pelamar/administrasi',$isi,true) );
  6.             $this->load->view('akun_pelamar/menu',$array); 
  7.         }else {
  8.             redirect('index/index');
  9.             }
  10.     }
  11.  
  12. ---------------------Model-------------------------
  13. function lihat()
  14.     {
  15.         $this->db->order_by('id_form','ASC');
  16.         $query = $this->db->get('form');
  17.         return $query->result();
  18.     }
  19.  
  20. ------------------View-------------------------
  21. <form name='administrasi' method='POST' enctype='multipart/form-data' action='<?php echo base_url();?>halamanpelamar/administrasi_tambah'>
  22.     <?php
  23.         foreach($query as $row){
  24.             echo "$row->label :";
  25.             if($row->type == 'text' OR $row->type == 'file' OR $row->type == 'password'){
  26.                 echo "<input type='$row->type' name='$row->nama' value=''>";
  27.             }elseif($row->type == 'checkbox'){
  28.                 $row->value = json_decode($value);
  29.                 echo "<input type='$row->type' name='$row->nama' value='$value'>$value";
  30.             }
  31.         }
  32.     ?>
  33.  
  34.  
  35. </form>
Advertisement
Add Comment
Please, Sign In to add comment