Headers for variable redirection

I have a quesiton about how to use Headers to redirect to a welcome page based on which username was entered.

I have a basic login page that initates a session. An included file handles user validation and all header info. First the username and password are checked against a database:


Once validated the script checks if the person is “logged in” and then redirects them

<?php …

if ($user=“user1”){
header(“Location: http://website.com/welcomepage1.php”);
}else if ($user=“user2”){
header(“Location: http://website.com/welcomepage2.php”);
header(“Location: http://website.com/welcomegeneric.php”);
… ?>
I know this is not coded well but I am still learning. I have tried several ways of variable redirection but with no avail. Are there any suggestions? If this method seems wrong maybe I can have a the different web pages in the database and the header calls a variable through a MySQL query based on the entered username. Any advice is appreciated.
Thanks in advance.