I have a form in which there is a select field with many options. These options have numeric values and a text between option tags. What I want to do is to get the text instead of values when I post the form via submit button.
View that generates the select field:
echo form_dropdown('pos', $pos_options, '100', 'id="pos_select" class="form_input"');
the select part generated:
<select name="pos" id="pos_select" class="form_input">
<option value="0">about_history_title</option>
<option vlaue="1">about_history</option>
</select>
When the form is submited, the appropriate model is called via the controller(text.php):
text.php -> insert_text()
$this->admin_text_model->insert_text();
admin_text_model.php
public function insert_text()
{
$data = array(
'tx_page' => $this->input->post('page'),
'tx_pos' => $this->input->post('pos'),
'tx_body' => $this->input->post('add_text')
);
return $this->db->insert('text', $data);
}
Is there a way that I can get the text inside option tags in $this->input->post('pos')?
Perhaps something like:
'tx_pos' => $this->input->post('pos')->text?