Mega Code Archive
Categories
/
Php
/
Form
Setting defaults in a multi-valued select menu
$main_dishes = array('cuke' => 'B', 'stomach' => "B", 'tripe' => 'C', 'taro' => 'S', 'giblets' => 'E', 'abalone' => 'F'); print '
'; $selected_options = array(); foreach ($defaults['main_dish'] as $option) { $selected_options[$option] = true; } foreach ($main_dishes as $option => $label) { print '
' . htmlentities($label) . '
'; print "\n"; } print '
'; ?>