title: form editing with codeigniter
body: <p>i'm trying to edit my form field with codeigniter. The submitted values first shown the view and then the informations are edited. but when i submit the form the following error occurs</p>
  
  <p>A PHP Error was encountered</p>
  
  <p>Severity: Notice</p>
  
  <p>Message: Undefined offset: 0</p>
  
  <p>Filename: views/tupdate.php</p>
  
  <p>Line Number: 46</p>
  
  <p>in line 46 I have </p>
  
  <pre><code> &lt;input type="hidden" name="id" value="&lt;?php echo $info[0]-&gt;id  ?&gt;"&gt;
  </code></pre>
  
  <p>My controller :</p>
  
  <pre><code> function update($id = 0)
   {
     $data['info'] = $this-&gt;trainingUpdate_model-&gt;getdata_by_id($id);
  
     $this-&gt;load-&gt;view('tupdate', $data);
   }
  
  
  function super()
  {
      $id=$this-&gt;input-&gt;post('id');
      $data['title']=$this-&gt;input-&gt;post('title');
      $data['training_description']=$this-&gt;input-&gt;post('training_description');
  
      if ($this-&gt;trainingUpdate_model-&gt;update($id, $data)==TRUE)
      {
        $this-&gt;load-&gt;view('traing_update_success');
      }
      else
      {
        $this-&gt;load-&gt;view('S_unsuccess');
      }
  }
  </code></pre>
  
  <p>My Model:</p>
  
  <pre><code> function getdata_by_id($id = 0)
   {
      $this-&gt;db-&gt;where('id',$id);
      $sql = $this-&gt;db-&gt;get('training');
      return $sql-&gt;result();
   }
  
  
   function update($id,$data)
   {
     $this-&gt;db-&gt;where('id', $id);
     $this-&gt;db-&gt;update('training', $data);
  
     if ($this-&gt;db-&gt;affected_rows() == '1')
     {
       return TRUE;
     }
     return FALSE;
   }
  </code></pre>
  
  <p>And View:</p>
  
  <pre><code> &lt;form action="trainingUpdate/super" method="post"&gt;
  
     &lt;input type="hidden" name="id" value="&lt;?php echo $info[0]-&gt;id  ?&gt;"&gt;
     Title Name:&lt;input type="text" name="id" value="&lt;?php echo htmlspecialchars($info[0]-&gt;title) ?&gt;"&gt;
     Title Name: &lt;textarea type="text" name="overview" value=""&gt;&lt;?php echo $info[0]-&gt;training_description; ?&gt;&lt;/textarea&gt;
  
     &lt;input type="Submit" value="Update"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I'm getting why the information in not updating and why am getting that error.</p>
  
  <p>please help. thanks</p>
  
  <p>For some reason the submitted values are not getting into trainingUpdate/super() method, from where the submitted data is passed to the model. the from is going back to the same view page and giving the error. can anyone tell me why it is happening?? thanks again. </p>