The basic idea behind a login form is verifying the credentials when the person logs in and setting a cookie to remember the credentials when a new page is loaded.
You can check out the setcookie method (http://us.php.net/setcookie) to learn how to set a cookie.
You could also look into sessions (http://us.php.net/manual/en/function.session-start.php) which is a way to store data server-side for a specific user.
The following article will give you a better idea of how to write a login form: http://www.devshed.com/c/a/PHP/Creating-a-Secure-PHP-Login-Script/
Edit: As John pointed out, there are many security concerns when adding a login to your page. You should be aware that cookies can be hijacked and sessions can be stolen.
A few tricks to prevent this:
- Make sure there is no way for people to inject JavaScript into your page. For instance: http://ha.ckers.org/xss.html
- You should use HTTPS connections on pages that require login as this will prevent cookie stealing over unprotected connections.
- You might want to invalidate a cookie if the origine IP has changed in case a cookie is ever stolen.
Hope this helps,