Fieldsets 'IF ELSE' based on checkboxes?
Assuming you are looking for a #states based solution, which is new in Drupal 7.

First, note that you cannot use 0 as a key for #options. So rewrite your first field set as follows:

$form['Contract']['first'] = array(
 '#type' =&gt; 'checkboxes',
 '#title' =&gt; t('Products applying for:'),
 '#options' =&gt; array('b' =&gt; 'Product B', 'c' =&gt; 'Product C'),
 '#required' =&gt; TRUE, // Added
 );


Now, we hide/show the other fieldsets depending on the above checkboxes' values. 

$form['Contract']['product B'] = array(
  '#theme' =&gt; 'form_panel_table',
  '#type' =&gt; 'fieldset',
  '#tree' =&gt; TRUE, // not necessary if parent element has #tree = TRUE.
  '#title' =&gt; t('product b'),
  '#collapsible' =&gt; TRUE,
  '#collapsed' =&gt; TRUE
  '#states' =&gt; array(
      'visible' =&gt; array(
        ':input[name="first[b]"]' =&gt; array('checked' =&gt; TRUE),
      ),
    ),
);


Likewise, 

$form['Contract']['product C'] = array(
  '#type' =&gt; 'fieldset',
  '#tree' =&gt; TRUE,
  '#theme' =&gt; 'form_panel_table',
  '#title' =&gt; t('example'),
  '#collapsible' =&gt; TRUE,
  '#collapsed' =&gt; TRUE,
  '#states' =&gt; array(
    'visible' =&gt; array(
      ':input[name="first[c]"]' =&gt; array('checked' =&gt; TRUE),
    ),
  ),
);


What we are doing exactly is that we ask the Form API to generate necessary jQuery code that it should only show the field set in question only if the input tag (it's a specially jQuery selector that selects input, textarea, select, etc tags at once) with name "first" and its value c/b is checked. These 2 visibility settings are individual so there is no else if concept here. 

Also note that #tree has nothing to do with the form's settings. if the code above didn't work, try setting if off. When you have #tree, name attribute of input fields get changed so PHP can build an array of submitted information. There is nothing to do with the visibility settings (except it can make our visibility rule never become true)