title: Session Variables For Logging in
body: <p>I have a login page which the user logs in with a username and password, then i want to display if my user is logged in, his name, so i got a login() function to determine if they can login, if it returns true, then it sets up a session variable and then calls function get_logged_on_person() which first the users first and last name from my database, but then i dont know what to do from there on. Any help is appreciated; my login_action.php is as follows:</p>
  
  <pre><code># Get form data
  $username = $_POST['username'];
  $password = $_POST['password'];
  
  if (login($username, $password) == true) {
      session_start();
      $sessionid = session_id();
      $insession = true;
      $logonas = get_logged_on_person($username);
      $firstname = $logonas.firstname;
      $lastname = $logonas.lastname;
      $_SESSION['firstname'] = $firstname;
      $_SESSION['lastname'] = $lastname;
          ????
  
  
  }else{
    $error = "Incorrect login.";
    header("Location: login.php?error=$error");
    exit;
  }
  
  ?&gt;
  </code></pre>