<?php 

uss::focus( 'portal/register', function() {
	
	$prefix = DB_TABLE_PREFIX;
	
	$key = uss::query(1);
	
	require realpath( __DIR__ . '/../' ) . "/style.php";
	
	$SQL = sQuery::select( "{$prefix}_departments", "1 ORDER BY name ASC" );
	
	$departments = uss::$global['mysqli']->query( $SQL );
	
	require __DIR__ . '/post.php';
	
	function __input( $key1, $key2 = null, $preval = '' ) {
		if( is_null($key2) ) $value = $_POST[ $key1 ] ?? null;
		else $value = $_POST[ $key1 ][ $key2 ] ?? null;
		if( empty($value) ) $value = $preval;
		echo "value='{$value}'";
	}
	
	uss::view(function() use($departments) {
		require __DIR__ . '/form.php';
	});
	
});