Undefined variable block...when trying to integrate a form into a block i was just beginning to build my first module which should display a checkbox in a block.

With this code (see below) I get an Error:
Notice: Undefined variable: block in ios_lang_checkbox_block_view()      

&lt;?php
function ios_lang_checkbox_menu() {
    $items['ios'] = array(
        'title' =&gt; 'View the sample form',
        'page callback' =&gt; 'drupal_get_form',
        'page arguments' =&gt; array('ios_lang_checkbox_nameform'),
        'access callback' =&gt; TRUE,
        'type' =&gt; MENU_NORMAL_ITEM
    );
    return $items;
}

/**
 * Define a form.
 */
function ios_lang_checkbox_nameform() {
    $options = array(
        'de' =&gt; t('de'),
        );
    $form['ios'] = array(
        '#title' =&gt; t('Your Name'),
        '#type' =&gt; 'checkboxes',
        '#description' =&gt; t('Choose language'),
        '#options' =&gt; $options,
    );
    $form['submit'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; t('Submit')
    );
    return $form;
}
function ios_lang_checkbox_block_view($delta='')
{
  switch($delta) {
    case 'ios_lang_checkbox':
      $block['subject'] = null; // Most forms don't have a subject 
      $block['content'] = drupal_get_form('ios_lang_checkbox_form_function');
      break;
   }
   return $block;
 }

?&gt; 


Any help with that?
In order for hook_block_view() to work properly you also need to implement hook_block_info(), which in your case would look something like this:

function ios_lang_checkbox_block_info() {
  return array(
    'ios_lang_checkbox' =&gt; array(
      'info' =&gt; t('Block Name'),
      'description' =&gt; t('Block description')
    )
  );
}


That will register a block called ios_lang_checkbox, which will become the $delta var when your implementation of hook_block_view() is invoked.

At the moment, when that function executes there's no $delta available (since one hasn't been defined), and hence $block is undefined when you return it. Usually one would write $block = array() at the start of the function to avoid this, but in your case that would actually just have masked the problem.

The signature for your form function is slightly wrong, that needs to be:

function ios_lang_checkbox_nameform($form, &amp;$form_state) {


It won't actually affect anything on a form that simple, but it's a good practice to get into...eventually it will come back to bite you if you don't!

The other small issue is the name of the form function you're calling inside hook_block_view()...I suspect you mean it to be the same form that's available from the path defined in hook_menu(), in which case that line should be:

$block['content'] = drupal_get_form('ios_lang_checkbox_nameform');


Once you've made the changes, make sure to clear Drupal's caches...otherwise your new hook implementation won't get picked up.