Module Block destroys head I'm struggling with blocks and a custom module. What I've got so far is a module which generates a block with that code:

function commerce_bulk_invoice_block_info() {
    $blocks = array();
    $blocks['showinvoiceoptions'] = array(
        'info' =&gt; t('Define Invoice Options'),
    );
    return $blocks;
}
function commerce_bulk_invoice_block_view($block_name = '') {
    if ($block_name == 'showinvoiceoptions') {
        echo '&lt;div id="invoice-block"&gt;';
        if(!isset($_SESSION['selected_entities'])) {
            echo 'select a product first';
        } else {
            echo '&lt;h1&gt;SESSION Variables:&lt;/h1&gt;';
            echo '&lt;pre&gt;';
            print_r($_SESSION['selected_entities']);
            echo '&lt;/pre&gt;';
        }
        echo '&lt;/div&gt;';
    }
}


My problem is, the content generated by hook_block_view is not shown in the selected region but directly after the opening body tag. And it pulls the whole head-content into the body. Anyone knows a solution for that?
By the documentation, you should return content you want in block, not echo it.

$block['subject'] = t('Subject'); // String here
$block['content'] = t('Content'); // Array or string here
return $block;