title: i need to insert employee and service id in a table
body: <p>I need to insert employee id and service id into a new table addservice.i wrote a function add in my controller page where i get my employee id from the session and service id from the service table from the uri.
  In controller</p>
  
  <pre><code>public function add()
      {
      $this-&gt;load-&gt;library('session');
  
      $id = $this-&gt;uri-&gt;segment(4);
      $data_to_store = array('employee_id'=&gt;$taxdetails['total'],
      'service_id'=&gt;$id);
      $this-&gt;selected_model-&gt;store_employee($data_to_store);
                       $data['main_content'] = 'admin/selected/list';
          $this-&gt;load-&gt;view('includes/template', $data);  
  
      }
  </code></pre>
  
  <p>in model:
  this is my model file where wrote the code to insert the employee id and service id.</p>
  
  <pre><code>public function store_employee($data)
      {
          $insert = $this-&gt;db-&gt;insert('addservice', $data);
          return $insert;
      }
  </code></pre>
  
  <p>in view page</p>
  
  <pre><code>&lt;div class="container top"&gt;
  
        &lt;ul class="breadcrumb"&gt;
           &lt;li&gt;
            &lt;a href="http://localhost/elfanto/elfanto_billing/admin/addservice"&gt;
              Admin          &lt;/a&gt; 
            &lt;span class="divider"&gt;/&lt;/span&gt;
          &lt;/li&gt;
          &lt;li class="active"&gt;
            Service        &lt;/li&gt;
        &lt;/ul&gt;
  
  
       &lt;div class="row"&gt;
          &lt;div class="span12 columns"&gt;
            &lt;div &gt;
  
              &lt;?php
  
              $attributes = array('class' =&gt; 'form-inline reset-margin', 'id' =&gt; 'myform');
  
              $options_manufacture = array(0 =&gt; "all");
              foreach ($category as $row)
              {
                $options_manufacture[$row['id']] = $row['name'];
              }
              //save the columns names in a array that we will use as filter         
              $options_products = array();    
              foreach ($service as $array) {
                foreach ($array as $key =&gt; $value) {
                  $options_products[$key] = $key;
                }
                break;
              }
  
  
              ?&gt;
  
            &lt;/div&gt;
  
            &lt;table class="table table-striped table-bordered table-condensed"&gt;
              &lt;thead&gt;
                &lt;tr&gt;
                  &lt;th class="header"&gt;Service id&lt;/th&gt;
                  &lt;th class="yellow header headerSortDown"&gt;Service name &lt;/th&gt;
                  &lt;th class="green header"&gt;Service catogary&lt;/th&gt;
                  &lt;th class="red header"&gt;Service tax&lt;/th&gt;
                  &lt;th class="red header"&gt;Service length&lt;/th&gt;
                  &lt;th class="red header"&gt;Service price&lt;/th&gt;
                  &lt;th class="red header"&gt;Actions&lt;/th&gt;
                &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                &lt;?php
                foreach($service as $row)
                {
                  echo '&lt;tr&gt;';
                  echo '&lt;td&gt;'.$row['id'].'&lt;/td&gt;';
                  echo '&lt;td&gt;'.$row['service_name'].'&lt;/td&gt;';
                  echo '&lt;td&gt;'.$row['category'].'&lt;/td&gt;';
                  echo '&lt;td&gt;'.$row['service_tax'].'&lt;/td&gt;';
                  echo '&lt;td&gt;'.$row['service_length'].'&lt;/td&gt;';
                  echo '&lt;td&gt;'.$row['service_price'].'&lt;/td&gt;';
                  echo '&lt;td class="crud-actions"&gt;
                    &lt;a href="'.site_url("admin").'/selected/add/'.$row['id'].'" class="btn btn-info"&gt;Add service&lt;/a&gt;  
  
                  &lt;/td&gt;';
                  echo '&lt;/tr&gt;';
                }
                ?&gt;      
              &lt;/tbody&gt;
            &lt;/table&gt;
   &lt;a href='admin/employee/add' class="btn btn-info"&gt;Continue as chair renter&lt;/a&gt; 
            &lt;?php echo '&lt;div class="pagination"&gt;'.$this-&gt;pagination-&gt;create_links().'&lt;/div&gt;'; ?&gt;
  
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>this code doesnt work for. i am not able to resolve my problem can someone correct my code.</p>