I have asked this before but code still not working.
I have a login system which works fine but the next step I want to do is redirect each user depending on their medals they have, which is either 1, 2, 3, 4 or 5. In the mysql database I have a field called medals which is pre filled in for each username and password to 1 of the 5 amounts.
so lets say a user with 1 medal logs in i want it to go to location 'page1.html'
if a user with 2 medals logs in i want it to go to location 'page2.html'
if a user with 3 medals logs in i want it to go to location 'page3.html' and so on.
I have tried the following code but it does not redirect successfully:
// Check username and password match
if (mysql_num_rows($login) == 1) {
// Set username session variable
$_SESSION['username'] = $_POST['username'];
// Jump to secured page
$row = mysql_fetch_row($sql);
switch ($row['medals']):
case 1:
header('location: page1.html');
exit;
case 2:
header('location: page2.html');
exit;
case 3:
header('location: page3.html');
exit;
case 4:
header('location: page4.html');
exit;
case 5:
header('location: page5.html');
exit;
}
else {
// Jump to login page
header('Location: login.php');
}
?>
any help would be great