title: Passing dropdown list value to controller in codeigniter
body: <p>hi i have been able to upload image path to database with codeigniter, but i cant seem to pass the option of category to database. i have dropdown menu with 2 option and then i want to pass it to controller so i can insert it to the database.</p>
  
  <p>here is my code:</p>
  
  <p>my view</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Upload Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;?php echo $error;?&gt;
  
  &lt;?php echo form_open_multipart('upload/do_upload');?&gt;
  
  &lt;input type="file" name="userfile" size="20" /&gt;
  &lt;br /&gt;
  &lt;select name="album" id="album"&gt; // my dropdown list
      &lt;option value="staff"&gt;Album Staff&lt;/option&gt;
      &lt;option value="gallery"&gt;Gallery&lt;/option&gt;
  &lt;/select&gt;
  &lt;br /&gt;&lt;br /&gt;
  
  &lt;input type="submit" value="upload" /&gt;
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and this is my controller</p>
  
  <pre><code>&lt;?php
  
  class Upload extends CI_Controller {
  
      function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;helper(array('form', 'url'));
      }
  
      function index()
      {
          $this-&gt;load-&gt;view('upload_form', array('error' =&gt; ' ' ));
      }
  
      function do_upload()
      {
          $config['upload_path'] = './assets/images';
          $config['allowed_types'] = 'gif|jpg|png';
          $config['max_size'] = '1000';
          $config['max_width']  = '1024';
          $config['max_height']  = '768';
          $config['overwrite'] = TRUE;
          $config['remove_spaces'] = TRUE;
          $config['encrypt_name'] = FALSE;
          $this-&gt;load-&gt;library('upload', $config);
  
          if ( ! $this-&gt;upload-&gt;do_upload())
          {
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
              $this-&gt;load-&gt;view('upload_form', $error);
          }
          else
          {
              $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
              $this-&gt;load-&gt;view('upload_success', $data);
              $upload_info=$this-&gt;upload-&gt;data();
              $insert_data = array(
              'imgfilename' =&gt; $upload_info['file_name'],
              'imgfilepath' =&gt; $upload_info['file_path'],
              'album' =&gt; $this-&gt;input-&gt;post('album') //trying to get the value from select in view
              );
              $this-&gt;db-&gt;insert('db_images', $insert_data);
  
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>how should it be done? any solution?</p>