3
Contributors
2
Replies
6
Views
1 Year
Discussion Span
Last Post by Ajay Gokhale
0

Hi,
As per my understanding you need so show data in dropdown (In view file) i.e. showing country list in from.
Ex: Showing Country list in dropdown
A) Create a model to fetch all data from "countrymaster" table
-- Controller --
$data = array();
$data['countrylist'] = $this->localizationmodel->getCountryList();
// I asume that you are created model localizationmodel
// Pass data to view file
$this->load->view('myform', $data);

-- View file --
<select class="form-control" name="country_id" id="city_h" style="width:100%;" >
<?php foreach( $countrylist as $key=>$val): ?>
<option value="<?php echo $val->countrymaster_id; ?>" ><?php echo $val->country_name; ?></option>
<?php endforeach; ?>
</select>

Note: You need to create a table i.e. country_master which is having fields like countrymaster_id, country_name etc.

Please check and let me know.

Thanks,
Ajay

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.