The other answers have provided direct solutions to your particular problem, but I'll elaborate a little more on the security behind your code - just for your and other's reference. Feel free to add onto this or correct me as necessary.
Storing passwords in md5 is a no-no. This is because the md5 hashing algorithm can be brute-forced easily/quickly. Also, you use mysql_ functions, which are deprecated. You should be using PDO (or alternatively mysqli_ functions). Luckily, you sanitize your data - however, these functions are no longer maintained, so I would recommend switching.
This is a great tutorial on creating a basic log in system with PDO and a SALT. I highly recommend you review it and re-implement your login system with a method like this for a couple reasons:
In general, if you have the opportunity to add more security to your system without unreasonably inconveniencing your users (like storing SALTs and using strong hashing algorithms), take the opportunity ahead of time to reduce the headache you'll face in the future.
Hope this helps!