The answer is... 'yes'.
(Helpful, isnt it?)
The form itself, and the database, are entirely separate entities - the one thing that links them together is the quer(ies) that you issue to get your data.
So, make your form, make your database, use sessions to keep track of the user's login status.
The question you've asked is a very broad one. I'd suggest either working on it a bit before asking for help, ask a more targeted question, or use a predefined login setup.
Some general pointers:
The password should be one-way hashed. You can hash the input to check against the database.
Session_start must be invoked on every page in which you want to use the data in, OR update the timer on, your session.