title: what is the best security practice to escape my data before submitting it into my database in CodeIgniter
body: <p>i have written a function for insertion into my database. i have a small doubt . </p>
  
  <p><strong>Is my below code provides good security  to escape my data before submitting it into my database?</strong></p>
  
  <p>Please suggest me some solution for this if the below code does not provide good way of insetion of data into db
  views.php</p>
  
  <pre><code> &lt;? echo form_open('Setups/subject'); ?&gt; 
                   &lt;? echo '&lt;div id="level"&gt;'. $subjectname.' : '.form_input($fsubjectname); ?&gt;  
                   &lt;?  echo form_submit($submitbtn); 
                    echo form_reset($resetbtn);  
                    echo '&lt;/fieldset&gt;'; ?&gt;
  
     &lt;? echo form_close(); ?&gt;    
  </code></pre>
  
  <p>controller.php</p>
  
  <pre><code>class Setups extends CI_Controller  {
  
  function subject(){
      $this-&gt;load-&gt;helper('form'); 
      $this-&gt;load-&gt;model('Setupsmodel');
  
      if($this-&gt;input-&gt;post('subsubmit')){
          $this-&gt;Setupsmodel-&gt;entry_insert();
      }
  
      $data=$this-&gt;Setupsmodel-&gt;subjectsetup(); 
      $this-&gt;load-&gt;view('admin/setups/subject_setups',$data); 
    }
  }
  </code></pre>
  
  <p>model.php</p>
  
  <pre><code>  class Setupsmodel extends CI_Model {
  
    function __construct()
  {
      // Call the Model constructor
      parent::__construct();
  }
  
  function subjectsetup()
  {
   $data['subjectname']='Enter Subject Name';  
   $data['fsubjectname']=      
    array('name'=&gt;'subject_name','class'=&gt;'input','size'=&gt;30,'id'=&gt;'txtsubject'); 
  
   $data['formtopic']='Subject Details Form';
  
  
   $data['submitbtn'] = array(
  'name' =&gt; 'subsubmit',
  'class' =&gt; 'button',
  'value' =&gt; 'Submit',
  'type' =&gt; 'submit',
  'content' =&gt; 'Submit'
  
   );
    $data['resetbtn'] = array(
  'name' =&gt; 'button',
   'class' =&gt; 'rsetbutton',
  'value' =&gt; 'Reset',
  'type' =&gt; 'reset',
  'content' =&gt; 'Reset'
  );
  
   return $data;   
  }
  
  //--------------Insertion of new record in the table subjectdetails into the db------------
  
  function entry_insert(){
     $this-&gt;load-&gt;database();
     $data=array(
         'subject_name'=&gt;$this-&gt;input-&gt;post('subject_name'));
  $this-&gt;db-&gt;insert('subjectdetails',$data);
  }   
  } 
  </code></pre>