You need to debug the code to see why it is doing what it is doing. When I started in computers they filled a good size room and computer time was so valuable that you had to desk check your code for problems because there was no other option. I think that we are well past that. That is not to say that you shouldn't have a look for an obvious problem but if it isn't obvious then you can let the machine help you. If you are going to be a (PHP) programmer then you need to develop a debugging approach and you will probably want to get a debugging tool to help you. I built my own but there are open source debugging tools that you can get.
So back to your problem! For starters, you have a version of your form in both modules. The first thing that I would want to know (if I were you) is which module am I in when the screen "refreshes". It is re-displaying your form but which version is getting displayed. If you are in the Login module and it just keeps re-displaying the form when you click on the Submit button then your IF statement isn't working the way you expected. In that case, i'd want to see what the actual data value is. That can be as simple as echo'ing the value to see if it what you expected. You just keep narrowing it down until the problem is obvious or until you see that the data isn't what you expected but you can't figure out why. That might be the point at which it would make sense to post something and ask for help.
Someone else may look at your code and pick out the problem for you but that doesn't change the fact that dumping a bunch of code without going through some debugging steps on your own isn't the right way to go.
Reputation Points: 210
Solved Threads: 228
Nearly a Posting Virtuoso
Offline 1,389 posts
since Sep 2008