Here you go my friend:
add_filter( 'admin_init' , 'register_fields' );
function register_fields()
{
register_setting( 'general', 'msp_duration', 'esc_attr' );
add_settings_field( 'msp_duration', __('Cache Duration') ,'fields_html', 'general' );
}
function fields_html()
{
$value = get_option( 'msp_duration' );
$fields = array(
array(
"name" => __('Every 6 hours'),
"value" => 60 * 60 * 6,
),
array(
"name" => __('Every 12 hours'),
"value" => 60 * 60 * 12,
),
array(
"name" => __('Every 24 hours'),
"value" => 60 * 60 * 24,
),
array(
"name" => __('Every 48 hours'),
"value" => 60 * 60 * 48,
),
array(
"name" => __('Every Week'),
"value" => 60 * 60 * 24 * 7,
),
);
$output="<select name="msp_duration">";
foreach( $fields as $option )
{
$output .= '<option value="'. $option['value'] .'" '. selected( $option['value'], $value, false ) .'>';
$output .= $option["name"];
$output .= '</option>';
}
$output .= '</select>';
echo $output;
}
Use the value with: get_option( 'msp_duration' );