In my checkboxes if i have a 0 value it select this checkbox I have in my form a type 'checkboxes' form.

    // Form for the severity checkboxes.
    $kkkk_severity_levels = variable_get('kkkk_severity_levels', array());

    // Declare empty options array.
    $kkkk_severity_options = array();

    // Loop through each severity level and push to options array for form.
    foreach (watchdog_severity_levels() as $number_select =&gt; $severity) {
      $kkkk_severity_options[$number_select] = drupal_ucfirst(
        $severity);
    }

    // Checkboxes form.
    $form['kkkk_severity_levels'] = array(
      '#type'          =&gt; 'checkboxes',
      '#title'         =&gt; t('Type of log messages'),
      '#options'       =&gt; $kkkk_severity_options,
      '#default_value' =&gt; array_values($kkkk_severity_levels),
      '#required'      =&gt; TRUE,
    );


In these lines of code the watchdog_emergency has a key 0 so when i select something from checkboxes i take selected also emergency always as it gets me out : e.g if i select 'info' with key 6 it gets me out:

6 (String, 1 characters ) 6
0 (Integer) 0
1 (Integer) 0
2 (Integer) 0
3 (Integer) 0
4 (Integer) 0
5 (Integer) 0


7 (Integer) 0
and so it selects also the 'emergency' with key as 0... How I can solve this problem?
That's how the form API handles multiple selections for form elements.

You can easily solve it with standard language features:

$selected = array_filter($form_state['values']['kkkk_security_levels']);