CodeIgniter Forums
Unable to repopulate select box after form submit - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Unable to repopulate select box after form submit (/thread-45863.html)



Unable to repopulate select box after form submit - El Forum - 10-09-2011

[eluser]term25[/eluser]
I have this in my view:

Code:
$options = array(
  'first'  => 'First option',
  'second'    => 'Second option',
  'third'   => 'Third option',
);

echo form_dropdown('what', $options, 'third');

And now always the third option is shown when the fields are repopulating after submit validation error.

I can repopulate input fileds but I am unable to repopulate select dropdown boxes.

How to repopulate them after submit?

I do not want that user get back when he had make a mistake and everything he chose in dropdown selectboxes is missing and he has to set it again.

Thanks in advance for any help.