title: CodeIgniter Dropdown menu
body: <p>I have a view (<strong>myView</strong>) in which there is a form. The form action is <strong>myController/myFunction1</strong> which is used to validate the input variables in the form and insert it to the database by calling a model function. This works perfectly fine.</p>
  
  <p>Now, I need a dropdown box inside the form, for which the values will be fetched from a table (called <strong>business</strong>) in the db.</p>
  
  <p>This is the code I wrote in my model to fetch the values</p>
  
  <pre><code>    public function get_dropdown_list() {
          $this -&gt; db -&gt; select('business_name');
          $result = $this -&gt; db -&gt; get('business');
          if ($result -&gt; num_rows() &gt; 0) {
              foreach ($result-&gt;result_array() as $row) {
                  $new_row['value'] = htmlentities(stripslashes($row['business_name']));
                  $row_set[] = $new_row;
              }
          }
  
          return $row_set;
      }
  </code></pre>
  
  <p>I'm not entirely sure if this is correct.
  What I need to know is, if this is correct, what should be the code inside the controller and the view to display the result as a dropdown in the form in the <strong>myView</strong>.
  And if this model itself is wrong, how do I get it working?</p>
  
  <p>P.S. : I'm new to CodeIgniter. I have been going through S.O and various other sites to get this thing working for quite a bit of time now. This might seem to be a repeated question for which I'm really sorry, because I could not find a solution from the already available discussions dealing with the same issue. Any help is very much appreciated.</p>