$states = ...
// states array of states with $states[0]['code'] = code of state $states[1]['name'];
// $selected_states is column that contains command separated list of states that are selection
$selected_states = split(',', $selected_states);
in html:
foreach ($states as $s): {
echo " ' . $s['title'] . ' ';
}
when posting back:
$selected_states = join(',', $_POST['states']); // Gives you a value you can store in your DB
hope this helps.