eerh..
a few points:
- Assume when coding that register_globals is switched off. So use $_POST[login] etc to retrieve posted variables. That might be one problem.
The other: If you give a name to a button, and check for it, it may give you a false, even when the button has been presed. it is safer to use a hidden variable to see wether the form has been submitted
Try to clean your code: add linebreaks, indenting etc to you rcode, so you can see the structure more easily, which will help debugging (Especially needed when dealing with larger sites!
J.