$mode = $_REQUEST['mode'];
$user_id = $_REQUEST['id'];
$action = $_REQUEST['action'];
$table = "system_users";
$table_role = "role";
$tbl_id = "u_userid";
$db = new db_transactions();
if ($mode == "user") {
    $usn = $_POST['u_username'];
    $pwd = $_POST['u_password'];
    $role_code = $_POST['u_rolecode'];
    $name = $_POST['u_name'];
    $btn = $_POST['btn'];
    $user = array($usn, $pwd, $role_code, $name);
    if ($btn == "u_submit") {
        if ($db->insertUser($user) > 0) {
            echo '<label class="control-label" for="inputSuccess">New user created successfully</label> <br \\> Return to <a href="dashboard.php" >Dashboard</a>';
        } else {
            echo '<label class="control-label" for="inputError">New user was not created.</label><br \\>Return to <a href="dashboard.php" >Dashboard</a>';
        }
    } else {
        if ($btn == "u_update") {
            if ($db->editUser($user, $user_id) > 0) {
                echo '<label class="control-label" for="inputSuccess">User details updated successfully</label> <br \\> Return to <a href="dashboard.php" >Dashboard</a>';
            } else {
                echo "id = " . $user_id;
                echo '<label class="control-label" for="inputError">User details was not updated.</label><br \\>Return to <a href="dashboard.php" >Dashboard</a>';
            }
        }
    }
} else {