title: Multiple values in Database separated by comma show these values one by one in Dropdown list using Codeigniter
body: <p>i have a shopping store many products which have multiple color values or some products have multiple size values like. <strong>small,medium,large,XL</strong></p>
  
  <p>i'm store like these values in database column and want to show one by one in dropdown select list. i using codeigniter for this but nothing show in dropdown list. Here is my code.</p>
  
  <p><strong>Model</strong></p>
  
  <pre><code>public function get_all()
      {
          $this-&gt;db-&gt;select()
                   -&gt;from('vendor_products')
                   -&gt;order_by(1,'DESC');
          $data = $this-&gt;db-&gt;get();
          $query = $data-&gt;result_array();
  
          foreach ($query as $result) {
  
              if (!empty($result['color_values'])) {
                  $result['color_values'] = explode('||' , $result['color_values']);
              }
              if (!empty($result['size_values'])) {
                  $result['size_values'] = explode('||',$result['size_values']);
              }
          }
          return $query;
      }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function index()
      {
          $this-&gt;load-&gt;model('cartm');
          $data['posts'] = $this-&gt;cartm-&gt;get_all();
          $this-&gt;load-&gt;view('cart/index',$data);
      }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;?php if($post['color_values']) : ?&gt;
                          &lt;p&gt;Color: &lt;select&gt;
      &lt;?php foreach($post['color_values'] as $optvalue) : 
          $option_array = explode('::', $optvalue);
      ?&gt;
      &lt;option value="&lt;?=$option_array[0]?&gt;"&gt;&lt;?=$option_array[1]?&gt;&lt;/option&gt;
      &lt;?php endforeach; ?&gt;
                          &lt;/select&gt;&lt;/p&gt;
      &lt;?php endif; ?&gt;
  
      &lt;?php if($post['size_values']) : ?&gt;
                          &lt;p&gt;Size: &lt;select&gt;
      &lt;?php foreach($post['size_values'] as  $optsize) : 
          $opt_size = explode('::', $optsize)
      ?&gt;
       &lt;option value="&lt;?=$opt_size[0]?&gt;"&gt;&lt;?=$opt_size[1];?&gt;&lt;/option&gt;
      &lt;?php endforeach;?&gt;
                          &lt;/select&gt;&lt;/p&gt;
      &lt;?php endif; ?&gt;
  </code></pre>