PHP code for login with different subpages
I would like to ask for help with PHP code for login. I need that user who is already loged in was redirected with his parameter TOWN, which has this user in mysql dtb to the subpage town.php. I am sorry I am beginner with PHP :-).
After log in Mrkva will go to A.php and Slana to B.php. Thank you very much.
-table in Mysql dtb
surname pass town
Mrkva 123 A
Slana 456 B
mysql_connect($dbhost,$dbuser,$dbpassword) or die("cannot connect");
mysql_select_db($db) or die("cannot select DB");
$surname = $_POST['surname'];
$pass = $_POST['pass'];
$sql="SELECT * FROM $tbl WHERE surname='$surname' and pass='$pass' ";