Skip to content

Instantly share code, notes, and snippets.

@zvineyard
Created July 9, 2012 20:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zvineyard/3078575 to your computer and use it in GitHub Desktop.
Save zvineyard/3078575 to your computer and use it in GitHub Desktop.
CodeIgniter: Add blank value to form_dropdown() and validate
$this->form_validation->set_rules('test', 'Test Field', 'required');
$options = array('' => 'Select One...');
foreach($tests->result() as $test) {
$options[$test->id] = $test->name;
}
echo form_dropdown('test', $options, set_value('test'));
@rajeshnanda33
Copy link

great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment