I have a dropdown field in my form and when I hit submit the form goes through validation and if an error happens, return all the value. This work expect for my dropdown meu, I have the set_value in the dropdown but it doesnt work :(
Here is my code
<?php echo form_dropdown('gender', $gender, set_value('gender')); ?>
What am I doing wrong or missing?
Doing this worked well:
<?php
$selected = ($this->input->post('gender')) ? $this->input->post('gender') : 'M';
$gender = array("M" => "Male", "F" => "Female");
echo form_dropdown('gender', $gender, $selected);
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With