How to redirect to specified page after form was submitted?

> Warning: Cannot modify header information - headers already sent by
> (output started at `wordpress\wp-admin\menu-header.php:94`) in
> `wordpress\wp-content\plugins\test\test.php` on line 16

    <?php
    /*
    Plugin Name: TEST
    Plugin URI: http://localhost/
    Description: TEST
    Version: 0.0.1
    Author: TEST
    Author URI: http://localhost/
    */
    add_action('admin_menu', 'test');
    function test() { 
        add_menu_page('test', 'test', 0, 'test/test.php', 'page');
    } 
    function page() {
        if(isset($_POST['submit'])) {
            header('Location: /index.php');
            exit;
        }
        echo '<form action="" method="post"><input type="submit" value="Submit form" name="submit" /></form>';
        var_dump($_POST);
    }