title: Codeigniter: Controller URI with Library
body: <p>I have a working controller and library function, but I now need to pass a URI segment to the library for decision making, and I'm stuck.</p>
  
  <p>Controller:</p>
  
  <pre><code>function survey($method)
  {
      $id = $this-&gt;session-&gt;userdata('id');
      $data['member'] = $this-&gt;home_model-&gt;getUser($id);
  
      //Convert the db Object to a row array
      $data['manager'] = $data['member']-&gt;row();
      $manager_id = $data['manager']-&gt;manager_id;
      $data['manager'] = $this-&gt;home_model-&gt;getUser($manager_id);
      $data['manager'] = $data['manager']-&gt;row();
      if ($data['manager']-&gt;credits == '0')   {
          flashMsg('warning',"You can't complete the assessment until your manager has purchased credit.");
          redirect('home','location');
      }
      elseif ($data['manager']-&gt;test_complete == '3'){
          flashMsg('warning',"You already completed the Assessment.");
          redirect('home','location');                        
      }
      else{
          $data['header'] = "Home";
          $this-&gt;survey_form_processing-&gt;survey_form($this-&gt;_container,$data);
      }
  }
  </code></pre>
  
  <p>Library: </p>
  
  <pre><code>function survey_form($container)
  {
             if($method ==1){
      $id = $this-&gt;CI-&gt;session-&gt;userdata('id');
      // Setup fields
      for($i=1;$i&lt;18;$i++){
        $fields["a_".$i] = 'Question '.$i;
      }
      for($i=1;$i&lt;17;$i++){
        $fields["b_".$i] = 'Question '.$i;
      }
      $fields["company_name"] = "Company Name";
      $fields['company_address'] = "company_address";
      $fields['company_phone'] = "company_phone";
      $fields['company_state'] = "company_state";
      $fields['company_city'] = "company_city";
      $fields['company_zip'] = "company_zip";
      $fields['job_title'] = "job_title";
      $fields['job_type'] = "job_type";
      $fields['job_time'] = "job_time";
      $fields['department'] = "department";
      $fields['supervisor'] = "supervisor";
      $fields['vision'] = "vision";
      $fields['height'] = "height";
      $fields['weight'] = "weight";
      $fields['hand_dominance'] = "hand_dominance";
      $fields['areas_of_fatigue'] = "areas_of_fatigue";
      $fields['injury_review'] = "injury_review";
      $fields['job_positive'] = "job_positive";
      $fields['risk_factors'] = "risk_factors";
      $fields['job_improvement_short'] = "job_improvement_short";
      $fields['job_improvement_long'] = "job_improvement_long";
      $fields["c_1"] = "Near Lift";
      $fields["c_2"] = "Middle Lift";
      $fields["c_3"] = "Far Lift";
      $this-&gt;CI-&gt;validation-&gt;set_fields($fields);
  
      // Set Rules
  
      for($i=1;$i&lt;18;$i++){
        $rules["a_".$i]= 'hour|integer|max_length[2]';
      }
      for($i=1;$i&lt;17;$i++){
        $rules["b_".$i]= 'hour|integer|max_length[2]';
      }
      // Setup form default values
      $this-&gt;CI-&gt;validation-&gt;set_rules($rules);
  
          if ( $this-&gt;CI-&gt;validation-&gt;run() === FALSE )
          {
              // Output any errors
              $this-&gt;CI-&gt;validation-&gt;output_errors();
          }
          else
          {
              // Submit form
              $this-&gt;_submit();
          }
      // Modify form, first load
      $this-&gt;CI-&gt;db-&gt;from('be_user_profiles');
      $this-&gt;CI-&gt;db-&gt;where('user_id' , $id);
      $user = $this-&gt;CI-&gt;db-&gt;get();
      $this-&gt;CI-&gt;db-&gt;from('be_survey');
      $this-&gt;CI-&gt;db-&gt;where('user_id' , $id);
      $survey =   $this-&gt;CI-&gt;db-&gt;get();
      $user = array_merge($user-&gt;row_array(),$survey-&gt;row_array());
      $this-&gt;CI-&gt;validation-&gt;set_default_value($user);
  
      // Display page
      $data['user'] = $user;
      $data['header'] = 'Risk Assessment Survey';
      $data['page'] = $this-&gt;CI-&gt;config-&gt;item('backendpro_template_public') . 'form_survey';
      $this-&gt;CI-&gt;load-&gt;view($container,$data);
              }
              else{
                   redirect('home','location');
              }
  }
  </code></pre>
  
  <p>My library function doesn't know what to do with Method...and I'm confused.  Does it have something to do with instances in my library?</p>