title: Updating records codeigniter
body: <p>I am trying to update a table where id of the row is entered and title is selected through a dropdown list, but I have two problems.
  Firstly Im not sure how to pass the data to the model, and the second problem is actually updating the table using active record.</p>
  
  <p>controller class</p>
  
  <pre><code>class Update extends CI_Controller {
  
  public function __construct()
  {
          parent::__construct();
          //$this-&gt;load-&gt;model('addmodel');
          //$this-&gt;load-&gt;helper('form');
  }
  
  public function index()
  {
      $this-&gt;load-&gt;view('updview');
  
  }
  
  public function updtitle() 
  {   
  
      $data = array(
      'id' =&gt; $this-&gt;input-&gt;post('id'),
      'title' =&gt; $this-&gt;input-&gt;post('title') );
      //$data1['data'] = $data;
  
      $data1['data'] = $this-&gt;updmodel-&gt;upddata($data);
      $this-&gt;load-&gt;view('updview', $data1);
  }
  }
  
  ?&gt;
  </code></pre>
  
  <p>model class</p>
  
  <pre><code>class Updmodel extends CI_Model {
  // model constructor function
  function __construct() {
      parent::__construct(); // call parent constructor
      $this-&gt;load-&gt;database();
  }
  
  public function upddata($data) {
  
      $this-&gt;db-&gt;where('emp_no', $data['id']);
      $this-&gt;db-&gt;update('title', $data['title']);
  
      return;
  }
  }
  
  ?&gt;
  </code></pre>
  
  <p>view
      
      
      
      
      
      <h1>Update employee title</h1></p>
  
  <pre><code>&lt;form action="http://localhost/ecwm604/index.php/update/updtitle" method="POST"&gt;
      employee id: 
          &lt;input type=text name="id"&gt;&lt;br /&gt;
      change title to: 
          &lt;select name="title"&gt;
              &lt;option value="Assistant Engineer"&gt;Assistant Engineer&lt;/option&gt;
              &lt;option value="Engineer"&gt;Engineer&lt;/option&gt;
              &lt;option value="Senior Engineer"&gt;Senior Engineer&lt;/option&gt;
              &lt;option value="Senior Staff"&gt;Senior Staff&lt;/option&gt;
              &lt;option value="Staff"&gt;Staff&lt;/option&gt; 
          &lt;/select&gt;&lt;br /&gt;
      &lt;input type="submit" value="submit"/&gt;
      &lt;br /&gt;
  &lt;?php
      print_r($data);
      //echo $data['title'];
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>