Welcome Guest, Not a member yet? Register   Sign In
Using foreach in codeigniter view to generate select options
#5

[eluser]CroNiX[/eluser]
Well, of course, because it's an array of associative arrays. You'd have to loop over it to access the 'group_title' key of each subarray.

I guess the first question is how do you want your dropdown to look? Show the actual
Code:
<option value="what_goes_here">What Text Goes Here</option>
And what fields those are coming from the database.

The CI dropdown helper needs the array in this format:
Code:
array(
  'option_value' => 'option_text',
  'option_value' => 'option_text',
  'option_value' => 'option_text'
)

The 'option_value' is what gets put as the what_goes_here (value) of the dropdown as shown above in my <option> example. The 'option_text' is what becomes the 'What Text Goes Here'.


Messages In This Thread
Using foreach in codeigniter view to generate select options - by El Forum - 09-05-2014, 08:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB