There are a lot of issues with your code. First, you have Javascript validate code in it and PHP at the bottom of the page and a few layout issues. I think it would be best if you review a login page tutorial that would walk you thru how to do this. Create some new code and then come back if you have problems. Here is a great tutorial that covers all of the steps for creating a login system. It explains everything including the uses of a database for this project. I think it will help you.
http://www.phpeasystep.com/phptu/6.html
Hope that helps! Good luck and let us know how you do with it.