Better way of handling isset/!empty?
I'd do this instead:

function validateForm() {
    if (!isset($_POST['submitform']))
        return false; // Maybe $controller-&gt;error = "Something"; as well?
    $inputs = array (
        'username', 'email', 'password',
        'repassword', 'password_f', 'repassword_f',
        'display'
    );
    foreach ($inputs as $key)
        if (empty($_POST[$key]))
        {
            global $controller;
            $controller-&gt;error = "";
            return false;
        }
    return true;
}
...
if (valudateForm()) {
    echo 2;
} else {
    // Form data not ok
}


Seems cleaner, no flags, no counting array elements, validation has its own function,...