title: Update record in database using codeigniter
body: <p>Hi there Iam using codeIgniter and I have managed to simply post a id number and phone number into the a table named "offers" both fields are INT, however when i try update a phone number corresponding to a specific id I see no changes in the database. I have listed my controller , model and view below</p>
  
  <p><strong>newOffer controller</strong></p>
  
  <pre><code>   &lt;?php 
      if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    //insert data into db using offer_model model
    // other option update submit 
    class newOffer extends CI_Controller {
         function addOffer() {
         //if the form is submitted           
         $this-&gt;load-&gt;view("check");
         $this-&gt;load-&gt;model("offer_model");
           if ($this-&gt;input-&gt;post('mysubmit')) {
               $this-&gt;offer_model-&gt;entry_insert();
            }
         }
  
          function updateOffer (){
             $this-&gt;load-&gt;view("check2");
             $this-&gt;load-&gt;model("offer_model");
             if ($this-&gt;input-&gt;post('mysubmit')) {
                  $this-&gt;offer_model-&gt;upddata();
              }
           }
      }
    ?&gt;
  </code></pre>
  
  <p><strong>offer_model</strong>
       
  
  <pre><code>class offer_model extends CI_Model{
  
   public function entry_insert(){
        $data = array(
             'idNum' =&gt; $this-&gt;input-&gt;post('idNum'),
              'phneNum' =&gt; $this-&gt;input-&gt;post('phneNum'),
  
          );
        $this-&gt;db-&gt;insert('offers',$data);
    }
  
     public function upddata($data) {
      $this-&gt;db-&gt;where('idNum', $idNum);
      $this-&gt;db-&gt;update('data' ,$data);
      //extract($data); 
    //$data['OfferName']
    //$this-&gt;db-&gt;where('OfferName' ,  $data['OfferName']); 
      //$this-&gt;db-&gt;update($Offers, array('OfferName' =&gt; $OfferName)); 
     return true;
      }
  }
   ?&gt;
  </code></pre>
  
  <p><strong>The view to update the values</strong></p>
  
  <pre><code>&lt;?form _open(base_url()."index.php/newOffer/updateOffer")?&gt;
  &lt;div class="form"&gt;
   // &lt;?php echo form_open('newOffer/addOffer'); ?&gt;
  &lt;legend&gt;Please enter details for your new offer&lt;/legend&gt;
  &lt;label for="ID Number"&gt;ID Number:  &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
  &lt;input type="text" name="idNum" id="idNum" placeholder="Please enter ID Number/&gt;
  &lt;label for="phone Number"&gt;Phone Number:&lt;/label&gt;
  &lt;input type="text" name="phneNum" id="phneNum " placeholder="Please enter phone Number"/&gt;
  
   &lt;fieldset class="submit_field"&gt;
       &lt;?php echo form_submit('mysubmit', 'Submit Form'); ?&gt;
   &lt;/fieldset&gt;
   &lt;/div&gt;&lt;!-- end of form div --&gt;
     ?&gt;
  </code></pre>