<?php
/*
Plugin Name: Demonstration of noheader bug
Plugin URI:
Description: Demonstration of noheader bug
*/

add_action('admin_menu', 'test_admin_menus');

function test_admin_menus() {
	$pluginPage = add_options_page('noheader test', 'noheader test', 'manage_options', 'noheader-test', 'test_display');
	add_action('admin_head-'.$pluginPage,'test_admin_head');
	
}

function test_admin_head() {
	//create a global var, so we know if run
	global $test_variable_to_test;
	$test_variable_to_test = 'PHP included!';
}

function test_display() {
	if ($_GET['noheader']) {require_once(ABSPATH.'wp-admin/admin-header.php');} //include the header if not included by WP
	
	global $test_variable_to_test;
	
	echo '<p>$test_variable_to_test was set to: <strong>'.$test_variable_to_test.'</strong></p>';

	echo '<form method="POST" action="'.get_bloginfo('url').'/wp-admin/options-general.php?page='.$_GET['page'].'&noheader=1">';
	echo '<p>Submit this form to see the $test_variable_to_test variable disapper</p>';
	echo '<input type="submit" />';
	echo '</form>';
}