title: Insert in to database using codeigniter
body: <p>HI </p>
  
  <p>i want to insert data using form in CI but i am facing the problem 
  Here is my model code</p>
  
  <pre><code>function add_form() {
      $this-&gt;load-&gt;database();
      $id = $this-&gt;input-&gt;post('id');
      $name = $this-&gt;input-&gt;post('name');
      $age = $this-&gt;input-&gt;post('age');       
      $data = array(
         'name' =&gt; $this-&gt;input-&gt;post('name'),
         'age' =&gt; $this-&gt;input-&gt;post('age'),
      );
      $this-&gt;db-&gt;insert('user',$data);
  }
  </code></pre>
  
  <p>Here is my controller code </p>
  
  <pre><code>function simpleform() {
      $this-&gt;load-&gt;helper('form');
      $this-&gt;load-&gt;helper('html');
      $this-&gt;load-&gt;model('welcomedb_model');
      if( $this-&gt;input-&gt;post('submit') ) {
          $this-&gt;welcomedb_model-&gt;add_form();
      }
      $this-&gt;load-&gt;view('welcomedb_view');
  }
  </code></pre>
  
  <p>and here is my view code </p>
  
  <pre><code>&lt;?php echo form_open('welcomedb/submit'); ?&gt;
     &lt;? echo $name; ?&gt;: 
     &lt;? echo form_input('name'); ?&gt;
     &lt;/br&gt;
     &lt;? echo $age; ?&gt;: 
     &lt;? echo form_input('age'); ?&gt;
     &lt;/br&gt;
     &lt;?php echo form_submit('submit', 'Submit'); ?&gt;
     &lt;?php echo form_close(); ?&gt;
  </code></pre>
  
  <p>Thanks for your help</p>