//define('IN_MANAGER_MODE', 'true');
//App::debug(get_defined_constants(true));

$path = realpath('/../' . dirname(__FILE__));
require_once $path.'/Resource/Save.php';
$crud = new Resource_Save;
$crud->set_content_fields($_POST['test']);
if( !empty($_POST) ) {
  $crud->execute();
}

//unset($crud->modx);
//App::debug($crud);

$fields = $crud->get_content_field_names();

$tvs_to_test = array(
  'tv_one'   => 'tv1',
  'tv_two'   => 'tv2',
  'tv_three' => 'tv3',
  'tv NA'    => 'tv99',
  );

foreach ($tvs_to_test as $label => $id) {
  $tv_val[$id] = isset($_POST[$id]) ? $_POST[$id] : '';
}
?>

<style type="text/css">
  .demo-form {