[eluser]teddy[/eluser]
I have a select list and when I submit with the validation is false the select list is not keep select value before I had choosen and I must select value again. Beside above I am newbie ci and how to use form_dropdown in my code below. Thank you for reading my topic.
View
Code:
<select class="default" name="diadiem">
<option value="--">--</option>;
<?php
foreach($tinhthanhpho as $diadiem)
{
echo "<option value='".$diadiem['id']."' >".$diadiem['ten_tinh']."</option>";
}
?>
</select>
My controller
Code:
function post()
{
$tinhthanhpho=$this->util_model->getTinhThanhPho();
$data['tinhthanhpho']=$tinhthanhpho;
}
My model
Code:
function getTinhThanhPho()
{
$sql="select * from tbl_tinhthanhpho";
$rs=$this->db->query($sql)->result_array();
return $rs;
}