Yea, an error or output would be helpful. But to try to help, echo out the SQL and make sure it looks correct. Then try to run the query somewhere like phpmyadmin or whatever mysql manager you use just to check if there are any rows coming back. If you see a row, call mysql_fetch_assoc on your $result and then print_r/var_dump that to see what you are getting back. perhaps also when you query, check if $result === false and if so echo mysql_error().
Some tips:
-don't use the mysql_* functions. they are deprecated and will be removed from php in a future version. use mysqli (mysql improved) or pdo. both do the same thing and are infinitely better than mysql_*. Use mysqli or pdo with binded parameters. It is simple to switch and easy to get the hang of.
-With the code the way it is, you will need to escape $userlevel also. Just because a form input is hidden, doesn't mean it can't be changed. currently your code is open to sql injection. seeing that query, if I know someone elses student number I could log in as them. for example if I wanted to login as student number 123, I could just change user level to:
Code:
' or studnumber=123
Of course, this could all be fixed if you would just use mysqli/pdo with bind.
-don't store passwords in the database without hashing them first. just please don't. you should be using a hashing function to one way hash the password. this means that if you hash the password, you get a seemingly random string. everytime you hash the same password, you get the same string and given the hashed string, you can't get the original password. you can store this string in the database and when checking the password, hash what the user typed in and compare these hashed strings. This ensures that if someone dumps the data in your database, usually through sql injection, you don't show them the password of every user.