title: Unable to insert data into database (PHP MVC)
body: <p>I want to allow people to submit their contacts by entering it into a field and it would eventually send it to the database but been trying it for quite some time and cant find out whats wrong with it, if possible do let me know how to return a echo saying "SENT" when its in database. Redirecting to the same page, if possible , dont even need a refresh to get that SENT shown to people.</p>
  
  <p>This is my Controller</p>
  
  <pre><code>  $this-&gt;config-&gt;db_config_fetch();
  $this-&gt;load-&gt;model('skills_model');
  
  //Get Form Data    
  $this-&gt;input-&gt;post('submitsms')  ;
  //GEt phone number from field
  $type = $this-&gt;input-&gt;post('phonenumber');
  //Call model
  $this-&gt;skills_model-&gt;addsms($type);
  }
  </code></pre>
  
  <p>This is my View @ home page</p>
  
  <pre><code>    &lt;form method="post" action="&lt;?php echo site_url(''); ?&gt;" name="form"  enctype="multipart/form-data"&gt;
    &lt;label&gt;SMS Subscription&lt;/label&gt;
    &lt;input type="text" name="phonenumber" placeholder="Phone Number here"&gt;      
    &lt;button class="btn btn-info" name="submitsms"  type="submit"&gt;Subscribe&lt;/button&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p>This is my Model</p>
  
  <pre><code>function addsms($type){
       $this-&gt;db-&gt;set('number', $type); 
       $this-&gt;db-&gt;insert('subscribers');
   }
  </code></pre>
  
  <p>I also tried the following</p>
  
  <pre><code>function addsms($type){     
      $sql = "INSERT INTO 'subscribers' ('number') VALUES ($type)";
      $this-&gt;db-&gt;query($sql);
      echo $this-&gt;db-&gt;affected_rows();
   }
  </code></pre>
  
  <p>You advice would be of a great help! thank you!</p>