I use checkboxes in a form to capture a users selection as:
$form['mbo_block_config']['livembo_classes_details'] = array(
'#type' => 'checkboxes',
'#title' => t('Class Details'),
'#description' => t('Choose class details to display.'),
'#options' => $details,
'#default_value' => variable_get('livembo_classes_details', array('c_id','c_cd_name')),
'#required' => TRUE,
);
The available options are stored in $details which is an associative array:
$details = array(
'c_id' => t('Class ID'),
'c_cd_name' => t('Class Name'),
'c_cd_description' => t('Class Description'),
'c_l_name' => t('Location: Name'),
'c_l_city' => t('Location: City'),
'c_l_full' => t('Location: Full Address'),
'c_l_phone' => t('Location: Contact Number'),
'c_s_FullName' => t('Staff: Name'),
'c_start ' => t('Class Start Time'),
'c_end' => t('Class End Time')
);
I use variable set variable_set('livembo_classes_details', $edit['livembo_classes_details']);
which works fine, however it flattens the array and changes the keys to values as per:
Array ( [0] => c_id [1] => c_l_phone [2] => c_l_name )
How can I retain the key/value format in the array as originally specified? For example:
Array ( [c_id] => t('Class ID') [c_l_phone] => t('Location: Contact Number') [c_l_name] => t('Location: Name') )