drupal7 custom form drop down show 0 I get a problem with my dropdown that shows "--select--","0","foods","meals" when I developing custom form with Drupal 7. The purpose of my dropdown is used to show "foods" and "meals" from category table. How does this "0" come from? I am hoping anyone suggestion to fix it.

function subcategory_form($form, &amp;$form_state= NULL, $my_object= '', $subcategoryId, $name, $categoryId) {

     $category = db_select('category', 'cat')
    -&gt;fields('cat')
    -&gt;execute();

    $rows[] = array();
    while($data = $category-&gt;fetchAssoc())
    {
        $rows[$data['id']] = t($data['name']);
        dpm($rows);
    }

    $form['category_name'] = array(
    '#type' =&gt; 'select',
    '#title' =&gt; t('Category'),
    '#options' =&gt; $rows,
    '#default_value' =&gt;t($categoryId),
    '#description' =&gt; t("Please select category."),
    '#required' =&gt; 'true'
  );

  return $form;
}
The code $rows[] = array(); will become a row in the array itself and will not just create an array as you probably want.

Change $rows[] = array(); to $rows = array();