So I'm using the form helper to set up a multiselect like so:
$certifiedTeacher = "I'm storing a value";
echo form_multiselect('certifiedTeacer', $certifiedTeacher, set_value('certifiedTeacher', $certifiedTeacher), 'id="certifiedTeacher" class="multiselect"');
After form post the correct value, in this example "I'm storing a value", is saved in the database. When I reload the page there are no values selected in the field.
If I select a field without a single quote everything works as expected and upno return that value is preselected.
I figured it out on my own. the issue is that the set_value function from CodeIgniter automatically escapes the HTML characters. Since $certifiedTeacher was not encoded they did not match.
The set_value function offers a third boolean parameter that allows you to turn off HTML escaping. This solved my issue. The new, corrected code is below:
$certifiedTeacher = "I'm storing a value";
//false added as a third parameter for set_value to turn off HTML escaping.
echo form_multiselect('certifiedTeacer', $certifiedTeacher, set_value('certifiedTeacher', $certifiedTeacher, false), 'id="certifiedTeacher" class="multiselect"');