title: error updating data in codeigniter
body: <p>i getting error when i want to update data. I am a newbie in Codeigniter and couldn't really figure out how to solve this. error display</p>
  
  <blockquote>
    <p>Severity: Notice</p>
  </blockquote>
  
  <p>Message: Undefined variable: tanggal, judul_berita, content</p>
  
  <p>Filename: admin/berita.php</p>
  
  <p>model</p>
  
  <pre><code>function get_berita($limit = 1, $offset = 0)
      {
          $this-&gt;db-&gt;order_by('id_berita','asc');
          $data = $this-&gt;db-&gt;get($this-&gt;tbl_berita, $limit, $offset);
          return $data-&gt;result();
      }
  
  function update_berita($id_berita,$data, $limit = 1, $offset = 0)
      {
          $this-&gt;db-&gt;where('id_berita', $id_berita);
          $this-&gt;db-&gt;update($this-&gt;tbl_berita, $data);
          $data = $this-&gt;db-&gt;get_where($this-&gt;tbl_berita, array('id_berita' =&gt; $id_berita), $limit, $offset);
          return $data-&gt;result();
      }
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>function edit_berita()
      {
          $this-&gt;form_validation-&gt;set_rules('tanggal', 'Tanggal', 'required');
          $this-&gt;form_validation-&gt;set_rules('judul_berita', 'Judul Berita', 'required');
          $this-&gt;form_validation-&gt;set_rules('content', 'Content', 'required');
  
          $id_berita = $this-&gt;uri-&gt;segment(4);
  
          if ($this-&gt;form_validation-&gt;run() == FALSE) 
          {
  
              $data['id_berita'] = $id_berita;
              $data['tanggal'] = $tanggal;          //line error
              $data['judul_berita'] = $judul_berita; //line error
              $data['content'] = $content;  // line error
              $this-&gt;data['contents'] = $this-&gt;load-&gt;view('admin/berita/edit_berita', $data, true);
              $this-&gt;data['orang'] = $this-&gt;mlogin-&gt;dataPengguna($this-&gt;session-&gt;userdata('username'));
              $this-&gt;load-&gt;view('template/wrapper/admin/wrapper_ukm',$this-&gt;data);
  
  
          }else{
  
              $this-&gt;load-&gt;model('mberita');
  
              $data = array(
                  'id_berita' =&gt; $id_berita,
                  'tanggal' =&gt; $this-&gt;input-&gt;post('tanggal'),
                  'judul_berita' =&gt; $this-&gt;input-&gt;post('judul_berita'),
                  'content' =&gt; $this-&gt;input-&gt;post('content')
  
              );
              $this-&gt;mberita-&gt;update_berita($id_berita,$data);
              redirect(site_url('admin/berita'));
          }       
      }
  </code></pre>
  
  <p>please help me what to do. thank you</p>