I'm trying to call upon a session ID but it doesn't seem to persist into one of the else clauses. If I set the session id via $username = $_SESSION["username"]; before that specific else clause, I can echo it at the end of the entire script, but if I put it inside that else clause I cannot echo it outside the script. Also, if I put it outside or in the else clause, I can't call upon it inside the else clause.
Here's the entire script: