将处理后的值恢复到php中的同一页面

I want that when I press login button I get the response back in the same page e.g. if user name doesn't exist or is duplicate it should show the error message on the same page, one more thing this data goes to another page and after some database action it returns the value, I got the value in the page where I use that database query, but how to get it back to the very first page from where I actually submitted it

this is the scenario login->function selector->controller(database query page) what I need to do is to get value from controller to login after a successful query generation here is a glimpse of code

<form method="post" action="selector.php?type=login" id="login" id="loginForm">
                <div class="row">
                    <div class="offset1 span1">            

                        <div class="lbel"><label class="control-label" for ="loginName">Username/Email</label></div>
                        <div class="lbl_inpuCnt"><input type="text" class="input-xlarge" id="loginName" name="loginName" maxlength="50"/></div>
                        <div id="usernameError" style="font-size: 10px; color: red;">&nbsp;</div>
                        <div class="lbel"><label class="control-label" for="loginPassword">Password</label></div>
                        <div class="controls">
                            <input type="password" class="input-xlarge" id="loginPassword" name="loginPassword" maxlength="50"/>
                        </div>
                        <div id="passwordError" style="font-size: 10px; color: red;">&nbsp;</div><br/>
                    </div>
                </div>
                <div style="margin-left: 55px;">
                    <input class="btn" style="width: 80px;" type="reset" name="reset" value="Reset" onclick="clearFields()"/>
                    <input class="btn" style="width: 80px;" type="submit" name="submit" value="Login" onclick="return validateForm();"/>
                </div>
            </form>

then comes the selector page

<?php
include_once 'classes/controller.php';
$controller = new controller();
switch ($_GET['type']) {
case 'signup':
    $registerStatus = $controller->register($_POST);
    $_POST['username'] = $registerStatus;
    break;
case 'login':{
    $result= $controller->login($_POST);
    echo $result; //here i get the value from next page after process, i need it back to   login page to show error there!
    }
    break;
case 'uploadSongs':
    $controller->uploadSongs();
    break;
case "delete":
    echo "Function Called";
    break;

} ?>

and this is the controller function in controller.php

public function login($request = array()) {
    $login = $request['loginName'];
    $password = ($request['loginPassword']);
    $query = "select * from user where (user_name = '" . $login . "' OR email = '" . $login . "') AND (password  = '" . $password . "')";
    $user = $this->model->select($query);

    if (is_array($user) && isset($user[0]['user_id'])) {
        $_SESSION['uid'] = $user[0]['user_id'];
        echo $_SESSION['name'] = $user[0]['first_name'];
        $this->redirect("userArea.php");
    } else {
        echo "-1";
        return $login;
    }
    exit;
}

Login page can submit to itself, and on a successful login, you redirect to member area. On a failed login, you simply display a message.