Welcome Guest, Not a member yet? Register   Sign In
Populate a Drop down from Database
#2

The $data array that you pass to the view, is automatically extracted bij CI. As a result, the view will not know the array $data, but it does know the variables that are part of it.
You can populate the dropdown with this:
PHP Code:
<?php echo form_dropdown('country_id',$country);?>

The form helper will build a <select></select> element. The array keys in $country will be used as values of the option elements, and the array values will be visible as text in the dropdown.

Hope this will help you.
Reply


Messages In This Thread
RE: Populate a Drop down from Database - by Wouter60 - 03-25-2016, 01:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB