Undefined index: first_name in (my file name) on line 41 Undefined index: last_name in (my file name) on line 42
"Undefined index" errors occurs when you trying accessing something that does not exists.
When you first put
if ($_SESSION['logged_in'] = true)
Inside $_SESSION['logged_in'] is now 'true'. Since it's a session, it stays like that until you clear your cookies/session in your browser. Or session_destroy().
Because it's true, and you fixed to '==', it's entering this condition now, but inside $_SESSION['first_name'] there is nothing.