I have several problems with the form_dropdown function in CodeIgniter .... My application consists of 2 parts, the user logs in, logs into the form and submits it .... after its submitted admin can login and edit what people form , and then save it to the database.
So, to display the drop-down list in the original form, im uses the following (all parameters in the drop-down list come from the database)
Model:
function get_salaries_dropdown()
{
$this->db->from($this->table_name);
$this->db->order_by('id');
$result = $this->db->get();
$return = array();
if($result->num_rows() > 0){
$return[''] = 'please select';
foreach($result->result_array() as $row){
$return[$row['id']] = $row['salaryrange'];
}
}
return $return;
}
Then in the controller:
$data['salaries'] = $this->salary_expectation->get_salaries_dropdown();
Then, finally, the view:
<?php echo form_dropdown('salaries', $salaries, set_value('salaries', $salaries)); ?>
This bit works great when displaying a drop-down list populated with values for user selection.
So, when the user selects a value, he removes save, it is saved in the database.
, , im, , , , , ?
,