1) all of the echos before the header function will cause the header function to fail.
the header function cannot perform a redirect if there is outout to the page before the header function is called.
2) I see you are setting the $MM_redirectLoginSuccess variable in this code:
echo ('18: UserRorle:'.$UserRole.'<br> Asign $MM_redirectLoginSuccess = getTheUserPage($UserRole)'); //Result: clerk...
$MM_redirectLoginSuccess = getTheUserPage($UserRole); // User index Page
but none of your echo statements actually tell you what it is being set to by the time it hots this code:
header("Location: " . $MM_redirectLoginSuccess );
really, you only need one echo, just before the header function:
echo("redirect: ".$MM_redirectLoginSuccess);
header("Location: " . $MM_redirectLoginSuccess );
if that shows the correct URL, then delete the echo statement, and it should redirect you to the correct place.